rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
return ansi[color] + time.strftime('%d-%m %H:%M:%S', time.localtime()) | t = time.time() return ansi[color] + time.strftime('%d-%m %H:%M:%S', time.localtime(t)) | def show(self): if step == op.delay: color = 'silver' else: color = 'gray' return ansi[color] + time.strftime('%d-%m %H:%M:%S', time.localtime()) |
line = dopen('/proc/%s/cmdline' % pid).read() self.val['name'] = os.path.basename(string.split(line, '\0')[1]) | l = string.split(dopen('/proc/%s/cmdline' % pid).read(), '\0') if len(l) > 2: self.val['name'] = os.path.basename(l[1]) | def extract(self): max = 0.0 for pid in os.listdir('/proc/'): try: int(pid) except: continue if os.path.exists('/proc/%s/stat' % pid): if pid == self.pid: continue if not self.cn1.has_key(pid): self.cn1[pid] = 0 |
self.vars = os.listdir('/proc/acpi/battery/') | self.vars = [] for battery in os.listdir('/proc/acpi/battery/'): for line in dopen('/proc/acpi/battery/'+battery+'/state').readlines(): l = string.split(line) if len(l) < 2: continue if l[0] == 'present:' and l[1] == 'yes': self.vars.append(battery) | def __init__(self): self.name = 'battery' self.format = ('f', 4, 34) self.vars = os.listdir('/proc/acpi/battery/') |
self.val[battery] = current * 100.0 / full | if current: self.val[battery] = current * 100.0 / full else: self.val[battery] = -1 | def extract(self): for battery in self.vars: for line in dopen('/proc/acpi/battery/'+battery+'/info').readlines(): l = string.split(line) if len(l) < 4: continue if l[0] == 'last': full = int(l[3]) break for line in dopen('/proc/acpi/battery/'+battery+'/state').readlines(): l = string.split(line) if len(l) < 3: continu... |
return time.strftime('%d-%m %H:%M:%S', time.gmtime()) | return time.strftime('%d-%m %H:%M:%S', time.localtime()) | def show(self): return time.strftime('%d-%m %H:%M:%S', time.gmtime()) |
if len(l) < 16: continue | if len(l) < 15: continue | def extract(self): max = 0.0 for pid in os.listdir('/proc/'): try: int(pid) except: continue if os.path.exists('/proc/%s/stat' % pid): if pid == self.pid: continue if not self.cn1.has_key(pid): self.cn1[pid] = 0 |
l = string.split(dopen('/proc/%s/cmdline' % pid).read(), '\0') | l = string.split(dopen('/proc/%s/cmdline' % self.val['pid']).read(), '\0') | def extract(self): max = 0.0 for pid in os.listdir('/proc/'): try: int(pid) except: continue if os.path.exists('/proc/%s/stat' % pid): if pid == self.pid: continue if not self.cn1.has_key(pid): self.cn1[pid] = 0 |
if pkgcmp(x[1][1:],mycatpkg[1:])>=0: | if pkgcmp(x[1][1:],cp[1:])>=0: | def dep_depreduce(self,mypkgdep): if mypkgdep[0]=="!": # !cat/pkg-v if self.exists_specific(mypkgdep[1:]): return 0 else: return 1 elif mypkgdep[0]=="=": # =cat/pkg-v return self.exists_specific(mypkgdep[1:]) elif (mypkgdep[0]=="<") or (mypkgdep[0]==">"): # >=cat/pkg-v or <=,>,< if mypkgdep[1]=="=": cmpstr=mypkgdep[0:2... |
def pkgscript(x,myebuildfile): myresult=getstatusoutput("/usr/sbin/ebuild "+myebuildfile+" "+x) if myresult[0] or myresult[1]: print if myresult[0]: print "Error code from",pkgname,x,"script --",myresult[0] if myresult[1]: print "Output from",myebuildfile,x,"script:" print print myresult[1] | def pathstrip(x,mystart): cpref=os.path.commonprefix([x,mystart]) return [root+x[len(cpref)+1:],x[len(cpref):]] | |
def dep_depreduce(mypkgdep): global inst if not installcache: installcache=port_insttree() if mypkgdep[0]=="!": if isinstalled(mypkgdep[1:]): return 0 else: return 1 elif mypkgdep[0]=="=": if isspecific(mypkgdep[1:]): if isinstalled(mypkgdep[1:]): return 1 else: return 0 else: return None elif mypkgdep[0:2]==">=":... | def dep_depreduce(mypkgdep): global inst #installcache holds a cached dictionary containing all installed packages if not installcache: installcache=port_insttree() #initialize cache if mypkgdep[0]=="!": #this is an exact package match if isinstalled(mypkgdep[1:]): return 0 else: return 1 elif mypkgdep[0]=="=": #this ... | |
def dep_parse(depstring): "Evaluates a dependency string" myusesplit=string.split(getsetting("USE")) mysplit=string.split(depstring) mysplit=dep_parenreduce(mysplit) mysplit=dep_opconvert(mysplit,myusesplit) if mysplit==None: return [0,"Parse Error (parenthesis mismatch or || abuse?)"] mysplit2=mysplit[:] mysplit2=d... | def dep_parse(depstring): "Evaluates a dependency string" myusesplit=string.split(getsetting("USE")) mysplit=string.split(depstring) #convert parenthesis to sublists mysplit=dep_parenreduce(mysplit) #mysplit can't be None here, so we don't need to check mysplit=dep_opconvert(mysplit,myusesplit) #if mysplit==None, then ... | |
x=x+1 | x=x-1 | def unmerge(category,pkgname): if os.path.isdir(os.path.normpath(root+"var/db/pkg/"+category+"/"+pkgname)): if root=="/": print "Unmerging",pkgname+"..." else: print "Unmerging",pkgname,"from",root+"..." print else: print pkgname,"not installed" return try: contents=open(os.path.normpath(root+"var/db/pkg/"+category+"/"... |
mycatpkg=string.split(mycatpkg,"/") if not os.path.isdir(root+"var/db/pkg/"+mycatpkg[0]): return 0 mypkgs=os.listdir(root+"var/db/pkg/"+mycatpkg[0]) if isjustname(mycatpkg[1]): for x in mypkgs: thispkgname=pkgsplit(x)[0] if mycatpkg[1]==thispkgname: return 1 else: | global installcache mycatpkg2=string.split(mycatpkg,"/") if not installcache: installcache=port_insttree() if isjustname(mycatpkg2[1]): if installcache.has_key(mycatpkg): return 1 else: return 0 else: mysplit=pkgsplit(mycatpkg2[1]) mykey=mycatpkg2[0]+"/"+mysplit[0] | def isinstalled(mycatpkg): mycatpkg=string.split(mycatpkg,"/") if not os.path.isdir(root+"var/db/pkg/"+mycatpkg[0]): return 0 mypkgs=os.listdir(root+"var/db/pkg/"+mycatpkg[0]) if isjustname(mycatpkg[1]): # only name specified for x in mypkgs: thispkgname=pkgsplit(x)[0] if mycatpkg[1]==thispkgname: return 1 else: # name... |
for x in mypkgs: if mycatpkg[1]==x: | if not installcache.has_key(mykey): return 0 for x in installcache[mykey]: if x[0]==mycatpkg: | def isinstalled(mycatpkg): mycatpkg=string.split(mycatpkg,"/") if not os.path.isdir(root+"var/db/pkg/"+mycatpkg[0]): return 0 mypkgs=os.listdir(root+"var/db/pkg/"+mycatpkg[0]) if isjustname(mycatpkg[1]): # only name specified for x in mypkgs: thispkgname=pkgsplit(x)[0] if mycatpkg[1]==thispkgname: return 1 else: # name... |
def installedcmp(mycatpkg): """Compares specific mycatpkg ("cat/pkg-1.2") against installed package version. Assumes that mycatpkg is already installed. Make sure it is before calling this. Returns 0 if mycatpkg is installed (exact version). Returns a positive number if an older version is installed, and returns a ne... | def isinstalled(mycatpkg): mycatpkg=string.split(mycatpkg,"/") if not os.path.isdir(root+"var/db/pkg/"+mycatpkg[0]): return 0 mypkgs=os.listdir(root+"var/db/pkg/"+mycatpkg[0]) if isjustname(mycatpkg[1]): # only name specified for x in mypkgs: thispkgname=pkgsplit(x)[0] if mycatpkg[1]==thispkgname: return 1 else: # name... | |
if installedcmp(mypkgdep[2:])<=0: return 1 | mycatpkg=catpkgsplit(mypkgdep[2:]) mykey=mycatpkg[0]+"/"+mycatpkg[1] if not installcache.has_key(mykey): return 0 for x in installcache[mykey]: if pkgcmp(x[1][1:],mycatpkg[1:])>=0: return 1 | def dep_depreduce(mypkgdep): if mypkgdep[0]=="!": if isinstalled(mypkgdep[1:]): return 0 else: return 1 elif mypkgdep[0]=="=": if isspecific(mypkgdep[1:]): if isinstalled(mypkgdep[1:]): return 1 else: return 0 else: return None elif mypkgdep[0:2]==">=": if not isspecific(mypkgdep[2:]): return None if isinstalled(getgen... |
if installedcmp(mypkgdep[2:])>=0: return 1 | mycatpkg=catpkgsplit(mypkgdep[2:]) mykey=mycatpkg[0]+"/"+mycatpkg[1] if not installcache.has_key(mykey): return 0 for x in installcache[mykey]: if pkgcmp(x[1][1:],mycatpkg[1:])<=0: return 1 | def dep_depreduce(mypkgdep): if mypkgdep[0]=="!": if isinstalled(mypkgdep[1:]): return 0 else: return 1 elif mypkgdep[0]=="=": if isspecific(mypkgdep[1:]): if isinstalled(mypkgdep[1:]): return 1 else: return 0 else: return None elif mypkgdep[0:2]==">=": if not isspecific(mypkgdep[2:]): return None if isinstalled(getgen... |
if not isspecific(mypkgdep[1:]): | if not isspecific(mypkgdep[2:]): | def dep_depreduce(mypkgdep): if mypkgdep[0]=="!": if isinstalled(mypkgdep[1:]): return 0 else: return 1 elif mypkgdep[0]=="=": if isspecific(mypkgdep[1:]): if isinstalled(mypkgdep[1:]): return 1 else: return 0 else: return None elif mypkgdep[0:2]==">=": if not isspecific(mypkgdep[2:]): return None if isinstalled(getgen... |
if isinstalled(getgeneral(mypkgdep[1:])): if installedcmp(mypkgdep[1:])>0: return 1 | if isinstalled(getgeneral(mypkgdep[2:])): mycatpkg=catpkgsplit(mypkgdep[2:]) mykey=mycatpkg[0]+"/"+mycatpkg[1] if not installcache.has_key(mykey): return 0 for x in installcache[mykey]: if pkgcmp(x[1][1:],mycatpkg[1:])<0: return 1 | def dep_depreduce(mypkgdep): if mypkgdep[0]=="!": if isinstalled(mypkgdep[1:]): return 0 else: return 1 elif mypkgdep[0]=="=": if isspecific(mypkgdep[1:]): if isinstalled(mypkgdep[1:]): return 1 else: return 0 else: return None elif mypkgdep[0:2]==">=": if not isspecific(mypkgdep[2:]): return None if isinstalled(getgen... |
if isinstalled(getgeneral(mypkgdep[1:])): if installedcmp(mypkgdep[1:])<0: return 1 | if isinstalled(getgeneral(mypkgdep[2:])): mycatpkg=catpkgsplit(mypkgdep[2:]) mykey=mycatpkg[0]+"/"+mycatpkg[1] if not installcache.has_key(mykey): return 0 for x in installcache[mykey]: if pkgcmp(x[1][1:],mycatpkg[1:])<0: return 1 | def dep_depreduce(mypkgdep): if mypkgdep[0]=="!": if isinstalled(mypkgdep[1:]): return 0 else: return 1 elif mypkgdep[0]=="=": if isspecific(mypkgdep[1:]): if isinstalled(mypkgdep[1:]): return 1 else: return 0 else: return None elif mypkgdep[0:2]==">=": if not isspecific(mypkgdep[2:]): return None if isinstalled(getgen... |
configdefaults=getconfig("/etc/make.defaults") configsettings=getconfig("/etc/make.conf") root=getsetting("ROOT") if len(root)==0: root="/" elif root[-1]!="/": root=root+"/" ERRPKG="" ERRVER="" | def init(): global installcache, configdefaults, configsettings, root, ERRPKG, ERRVER configdefaults=getconfig("/etc/make.defaults") configsettings=getconfig("/etc/make.conf") root=getsetting("ROOT") if len(root)==0: root="/" elif root[-1]!="/": root=root+"/" ERRPKG="" ERRVER="" installcache=None init() | def port_porttree(): """ This function builds a dictionary of available ebuilds in the portage tree. Dictionary format is: mydict["cat/pkg"]=[ ["cat/fullpkgname",["cat","pkg","ver","rev"] ["cat/fullpkgname",["cat","pkg","ver2","rev2"] ] """ portagedict={} mydir=getsetting("PORTDIR") if not os.path.isdir(mydir): return ... |
oldprovides=self.getprovides() | def merge(self,mergeroot,inforoot,mergestart=None,outfile=None): if mergestart==None: origdir=os.getcwd() if not os.path.exists(self.dbdir): self.create() #open contents file if it isn't already open mergestart=mergeroot print ">>> Updating mtimes..." #before merging, it's *very important* to touch all the files !!! o... | |
self.setprovides(None,oldprovides) | for mycatpkg in self.getelements("PROVIDE"): mycat,mypkg=string.split(mycatpkg,"/") mylink=dblink(mycat,mypkg) mylink.create() myvirts=mylink.getelements("VIRTUAL") if not mycat+"/"+mypkg in myvirts: myvirts.append(self.cat+"/"+self.pkg) mylink.setelements(myvirts,"VIRTUAL") | def merge(self,mergeroot,inforoot,mergestart=None,outfile=None): if mergestart==None: origdir=os.getcwd() if not os.path.exists(self.dbdir): self.create() #open contents file if it isn't already open mergestart=mergeroot print ">>> Updating mtimes..." #before merging, it's *very important* to touch all the files !!! o... |
def haselement(self,mycat,mypkg,ename): "boolean -- is the specified cat/pkg listed in this package's elements file?" mycmp=mycat+"/"+mypkg for x in self.getelements(ename): if x == mycmp: return 1 return 0 def hasprovide(self,mycat,mypkg): return self.haselement(mycat,mypkg,"PROVIDE") def getprovides(self): "get a l... | def isregular(self): "Is this a regular package (does it have a CATEGORY file? A dblink can be virtual *and* regular)" return os.path.exists(self.dbdir+"/CATEGORY") | def haselement(self,mycat,mypkg,ename): "boolean -- is the specified cat/pkg listed in this package's elements file?" mycmp=mycat+"/"+mypkg for x in self.getelements(ename): if x == mycmp: return 1 return 0 |
def ensureMinimal(minVersion): """ Checks to see if the default version of wxPython is greater-than or equal to `minVersion`. If not then it will try to find an installed version that is >= minVersion. If none are available then a message is displayed that will inform the user and will offer to open their web browser... | def versions_installed(): """Return list of installed wxPython versions""" | def ensureMinimal(minVersion): """ Checks to see if the default version of wxPython is greater-than or equal to `minVersion`. If not then it will try to find an installed version that is >= minVersion. If none are available then a message is displayed that will inform the user and will offer to open their web browser... |
if sys.modules.has_key('wx') or sys.modules.has_key('wxPython'): raise VersionError("wxversion.ensureMinimal() must be called before wxPython is imported") | installed = [] for v in WX_VERSIONS: i = 0 for e in ENCODINGS: ver = "wx-%s-%s" % (v, ENCODINGS[i]) if version_exists(ver): installed.append(ver) i += 1 return installed | def ensureMinimal(minVersion): """ Checks to see if the default version of wxPython is greater-than or equal to `minVersion`. If not then it will try to find an installed version that is >= minVersion. If none are available then a message is displayed that will inform the user and will offer to open their web browser... |
bestMatch = None minv = _wxPackageInfo(minVersion) defaultPath = _find_default() if defaultPath: defv = _wxPackageInfo(defaultPath, True) if defv >= minv: bestMatch = defv | def get_default(): """Return version of system default wxPython""" wxpath = "%s/wx.pth" % SITE_PKGS if not os.path.exists(wxpath): return None try: return open(wxpath, "r").read().strip() except: return None | def ensureMinimal(minVersion): """ Checks to see if the default version of wxPython is greater-than or equal to `minVersion`. If not then it will try to find an installed version that is >= minVersion. If none are available then a message is displayed that will inform the user and will offer to open their web browser... |
if bestMatch is None: installed = _find_installed() if installed: if installed[0] >= minv: bestMatch = installed[0] | def ensureMinimal(minVersion): """ Checks to see if the default version of wxPython is greater-than or equal to `minVersion`. If not then it will try to find an installed version that is >= minVersion. If none are available then a message is displayed that will inform the user and will offer to open their web browser... | |
if bestMatch is None: import wx, webbrowser versions = "\n".join([" "+ver for ver in getInstalled()]) app = wx.PySimpleApp() result = wx.MessageBox("This application requires a version of wxPython " "greater than or equal to %s, but a matching version " "was not found.\n\n" "You currently have these version(s) ins... | def print_installed(): """Print list of wxPython versions installed""" default = get_default() all = versions_installed() print "\nYou have these versions of wxPython installed:\n" for v in all: if v == default: print v, "(System default)" else: print v def version_exists(version): """Returns True if version of wxPyth... | def ensureMinimal(minVersion): """ Checks to see if the default version of wxPython is greater-than or equal to `minVersion`. If not then it will try to find an installed version that is >= minVersion. If none are available then a message is displayed that will inform the user and will offer to open their web browser... |
sys.path.insert(0, bestMatch.pathname) _selected = bestMatch def checkInstalled(versions): """ Check if there is a version of wxPython installed that matches one of the versions given. Returns True if so, False if not. This can be used to determine if calling `select` will succeed or not. :param version: Same as... | if options.version: set_default(options.version) | def ensureMinimal(minVersion): """ Checks to see if the default version of wxPython is greater-than or equal to `minVersion`. If not then it will try to find an installed version that is >= minVersion. If none are available then a message is displayed that will inform the user and will offer to open their web browser... |
global roottree, localtree, porttree, ebuild_initialized, root localtree=vartree("/") | global local_virts, root_virts, roottree, localtree, ebuild_initialized, root, virtuals local_virts=getvirtual("/") | def ebuild_init(): "performs db/variable initialization for the ebuild system. Not required for other scripts." global roottree, localtree, porttree, ebuild_initialized, root localtree=vartree("/") if root=="/": #root is local, and build dep database is the runtime dep database roottree=localtree else: #root is non-lo... |
root_virts=local_virts else: root_virts=getvirtual(root) localtree=vartree("/",local_virts) if root=="/": | def ebuild_init(): "performs db/variable initialization for the ebuild system. Not required for other scripts." global roottree, localtree, porttree, ebuild_initialized, root localtree=vartree("/") if root=="/": #root is local, and build dep database is the runtime dep database roottree=localtree else: #root is non-lo... | |
roottree=vartree(root) porttree=portagetree("/") | roottree=vartree(root,root_virts) | def ebuild_init(): "performs db/variable initialization for the ebuild system. Not required for other scripts." global roottree, localtree, porttree, ebuild_initialized, root localtree=vartree("/") if root=="/": #root is local, and build dep database is the runtime dep database roottree=localtree else: #root is non-lo... |
if mydo in ["prerm","postrm","preinst","postinst","config","touch","clean","digest","unmerge"]: pass elif mydo=="depend": return string.split(getoutput("/usr/sbin/ebuild.sh depend"),"\n") elif checkdeps: | if checkdeps: | def doebuild(myebuild,mydo,checkdeps=1): global settings if not os.path.exists(myebuild): print "!!!",myebuild,"not found." return 1 if myebuild[-7:]!=".ebuild": print "!!!",myebuild,"does not appear to be an ebuild file." return 1 settings.reset() settings["ROOT"]=root settings["STARTDIR"]=os.getcwd() settings["EBUILD... |
retval=dep_frontend("build",mydeps[0]) if (retval): return retval if mydo not in ["package","rpm"]: retval=dep_frontend("runtime",mydeps[1]) if retval: return retval | if mydo=="depend": return mydeps elif mydo=="check": return dep_frontend("build",mydeps[0]) elif mydo=="rcheck": return dep_frontend("runtime",mydeps[1]) if mydo in ["merge","qmerge","unpack", "compile", "rpm", "package"]: retval=dep_frontend("build",mydeps[0]) if (retval): return retval else: if mydo in ["depend","ch... | def doebuild(myebuild,mydo,checkdeps=1): global settings if not os.path.exists(myebuild): print "!!!",myebuild,"not found." return 1 if myebuild[-7:]!=".ebuild": print "!!!",myebuild,"does not appear to be an ebuild file." return 1 settings.reset() settings["ROOT"]=root settings["STARTDIR"]=os.getcwd() settings["EBUILD... |
if retval: return retval | if retval: return retval if checkdeps: retval=dep_frontend("runtime",mydeps[1]) if (retval): return retval | def doebuild(myebuild,mydo,checkdeps=1): global settings if not os.path.exists(myebuild): print "!!!",myebuild,"not found." return 1 if myebuild[-7:]!=".ebuild": print "!!!",myebuild,"does not appear to be an ebuild file." return 1 settings.reset() settings["ROOT"]=root settings["STARTDIR"]=os.getcwd() settings["EBUILD... |
doebuild(self.dbdir+"/"+self.pkg+".ebuild","prerm") | a=doebuild(self.dbdir+"/"+self.pkg+".ebuild","prerm") if a: print "!!! pkg_prerm() script failed; exiting." sys.exit(a) | def unmerge(self,pkgfiles=None): if not pkgfiles: pkgfiles=self.getcontents() if not pkgfiles: return myebuildfile=os.path.normpath(self.dbdir+"/"+self.pkg+".ebuild") if os.path.exists(myebuildfile): if pkgfiles.has_key(myebuildfile): del pkgfiles[myebuildfile] mykeys=pkgfiles.keys() mykeys.sort() mykeys.reverse() #... |
doebuild(self.dbdir+"/"+self.pkg+".ebuild","postrm") | a=doebuild(self.dbdir+"/"+self.pkg+".ebuild","postrm") if a: print "!!! pkg_postrm() script failed; exiting." sys.exit(a) | def unmerge(self,pkgfiles=None): if not pkgfiles: pkgfiles=self.getcontents() if not pkgfiles: return myebuildfile=os.path.normpath(self.dbdir+"/"+self.pkg+".ebuild") if os.path.exists(myebuildfile): if pkgfiles.has_key(myebuildfile): del pkgfiles[myebuildfile] mykeys=pkgfiles.keys() mykeys.sort() mykeys.reverse() #... |
doebuild(inforoot+"/"+self.pkg+".ebuild","preinst") | a=doebuild(inforoot+"/"+self.pkg+".ebuild","preinst") if a: print "!!! pkg_preinst() script failed; exiting." sys.exit(a) | def merge(self,mergeroot,inforoot,mergestart=None,outfile=None): if mergestart==None: origdir=os.getcwd() if not os.path.exists(self.dbdir): self.create() #open contents file if it isn't already open mergestart=mergeroot print ">>> Updating mtimes..." #before merging, it's *very important* to touch all the files !!! o... |
doebuild(self.dbdir+"/"+self.pkg+".ebuild","postinst") | a=doebuild(self.dbdir+"/"+self.pkg+".ebuild","postinst") if a: print "!!! pkg_postinst() script failed; exiting." sys.exit(a) | def merge(self,mergeroot,inforoot,mergestart=None,outfile=None): if mergestart==None: origdir=os.getcwd() if not os.path.exists(self.dbdir): self.create() #open contents file if it isn't already open mergestart=mergeroot print ">>> Updating mtimes..." #before merging, it's *very important* to touch all the files !!! o... |
os.makedirs(root+"etc/env.d") | prevmask=os.umask(0) os.makedirs(root+"etc/env.d",0755) os.umask(prevmask) | def env_update(): global root if not os.path.exists(root+"etc/env.d"): os.makedirs(root+"etc/env.d") fns=os.listdir(root+"etc/env.d") fns.sort() pos=0 while (pos<len(fns)): if fns[pos]<=2: del fns[pos] continue if (fns[pos][0] not in string.digits) or (fns[pos][1] not in string.digits): del fns[pos] continue pos=pos+1 ... |
mydeps=string.split(getoutput("/usr/sbin/ebuild.sh depend"),"\n") | myso=getstatusoutput("/usr/sbin/ebuild.sh depend") if myso[0]!=0: print "!!! Portage had a problem grabbing dependencies from:" print "!!!",settings["EBUILD"] print "!!! bash output was:" print print myso[1] print print "!!! doebuild() aborting." return 1 mydeps=string.split(myso[1],"\n") | def doebuild(myebuild,mydo,checkdeps=1,debug=0): global settings if not os.path.exists(myebuild): print "!!!",myebuild,"not found." return 1 if myebuild[-7:]!=".ebuild": print "!!!",myebuild,"does not appear to be an ebuild file." return 1 settings.reset() settings["PORTAGE_DEBUG"]=str(debug) settings["ROOT"]=root sett... |
os.path.mkdir(root+"tmp",01777) | os.mkdir(root+"tmp",01777) | def ebuild_init(): "performs db/variable initialization for the ebuild system. Not required for other scripts." global local_virts, root_virts, roottree, localtree, ebuild_initialized, root, virtuals local_virts=getvirtuals("/") if root=="/": root_virts=local_virts else: root_virts=getvirtuals(root) localtree=vartree... |
if dest!="/bin/cp": | if dest=="/bin/cp": getstatusoutput("/bin/mv /bin/cp /bin/cp.old") a=getstatusoutput("/bin/cp.old -a "+"'"+src+"' /bin/cp") os.unlink("/bin/cp.old") else: | def movefile(src,dest): """moves a file from src to dest, preserving all permissions and attributes.""" if dest!="/bin/cp": if os.path.exists(dest): os.unlink(dest) mymode=os.lstat(src)[ST_MODE] a=getstatusoutput("/bin/cp -a "+"'"+src+"' '"+dest+"'") os.chmod(dest,mymode) os.unlink(src) if a[0]==0: return 1 else: retur... |
a=getstatusoutput("/bin/cp -a "+"'"+src+"' '"+dest+"'") | def movefile(src,dest): """moves a file from src to dest, preserving all permissions and attributes.""" if dest!="/bin/cp": if os.path.exists(dest): os.unlink(dest) mymode=os.lstat(src)[ST_MODE] a=getstatusoutput("/bin/cp -a "+"'"+src+"' '"+dest+"'") os.chmod(dest,mymode) os.unlink(src) if a[0]==0: return 1 else: retur... | |
number=string.atoi(mynewver[0]) | number=string.atof(mynewver[0]) | def relparse(myver): number=0 p1=0 p2=0 mynewver=string.split(myver,"_") if len(mynewver)==2: #alpha,beta or pre number=string.atoi(mynewver[0]) if "beta" == mynewver[1][:4]: p1=-2 try: p2=string.atoi(mynewver[1][4:]) except: p2=0 elif "alpha" == mynewver[1][:5]: p1=-3 try: p2=string.atoi(mynewver[1][5:]) except: p2=0 ... |
p2=string.atoi(mynewver[1][4:]) | p2=string.atof(mynewver[1][4:]) | def relparse(myver): number=0 p1=0 p2=0 mynewver=string.split(myver,"_") if len(mynewver)==2: #alpha,beta or pre number=string.atoi(mynewver[0]) if "beta" == mynewver[1][:4]: p1=-2 try: p2=string.atoi(mynewver[1][4:]) except: p2=0 elif "alpha" == mynewver[1][:5]: p1=-3 try: p2=string.atoi(mynewver[1][5:]) except: p2=0 ... |
p2=string.atoi(mynewver[1][5:]) | p2=string.atof(mynewver[1][5:]) | def relparse(myver): number=0 p1=0 p2=0 mynewver=string.split(myver,"_") if len(mynewver)==2: #alpha,beta or pre number=string.atoi(mynewver[0]) if "beta" == mynewver[1][:4]: p1=-2 try: p2=string.atoi(mynewver[1][4:]) except: p2=0 elif "alpha" == mynewver[1][:5]: p1=-3 try: p2=string.atoi(mynewver[1][5:]) except: p2=0 ... |
p2=string.atoi(mynewver[1][3:]) | p2=string.atof(mynewver[1][3:]) | def relparse(myver): number=0 p1=0 p2=0 mynewver=string.split(myver,"_") if len(mynewver)==2: #alpha,beta or pre number=string.atoi(mynewver[0]) if "beta" == mynewver[1][:4]: p1=-2 try: p2=string.atoi(mynewver[1][4:]) except: p2=0 elif "alpha" == mynewver[1][:5]: p1=-3 try: p2=string.atoi(mynewver[1][5:]) except: p2=0 ... |
number=string.atoi(myver[0:divider]) else: number=string.atoi(myver) | number=string.atof(myver[0:divider]) else: number=string.atof(myver) | def relparse(myver): number=0 p1=0 p2=0 mynewver=string.split(myver,"_") if len(mynewver)==2: #alpha,beta or pre number=string.atoi(mynewver[0]) if "beta" == mynewver[1][:4]: p1=-2 try: p2=string.atoi(mynewver[1][4:]) except: p2=0 elif "alpha" == mynewver[1][:5]: p1=-3 try: p2=string.atoi(mynewver[1][5:]) except: p2=0 ... |
mybuildval=string.split(myval,'-') if len(mybuildval)==2: | global ERRVER ERRVER="" myval=string.split(myval,'.') for x in myval[1:]: x="."+x for x in myval[:-1]: | def ververify(myval): mybuildval=string.split(myval,'-') if len(mybuildval)==2: try: string.atoi(mybuildval[1]) myval=mybuildval[0] except: return 0 myval=string.split(myval,'.') for x in range(0,len(myval)-1): try: foo=string.atoi(myval[x]) except: return 0 endval=myval[-1:][0] try: string.atoi(endval) return 1 except... |
string.atoi(mybuildval[1]) myval=mybuildval[0] | foo=string.atof(x) | def ververify(myval): mybuildval=string.split(myval,'-') if len(mybuildval)==2: try: string.atoi(mybuildval[1]) myval=mybuildval[0] except: return 0 myval=string.split(myval,'.') for x in range(0,len(myval)-1): try: foo=string.atoi(myval[x]) except: return 0 endval=myval[-1:][0] try: string.atoi(endval) return 1 except... |
myval=string.split(myval,'.') for x in range(0,len(myval)-1): try: foo=string.atoi(myval[x]) except: return 0 endval=myval[-1:][0] | def ververify(myval): mybuildval=string.split(myval,'-') if len(mybuildval)==2: try: string.atoi(mybuildval[1]) myval=mybuildval[0] except: return 0 myval=string.split(myval,'.') for x in range(0,len(myval)-1): try: foo=string.atoi(myval[x]) except: return 0 endval=myval[-1:][0] try: string.atoi(endval) return 1 except... | |
string.atoi(endval) | string.atof(myval[-1]) | def ververify(myval): mybuildval=string.split(myval,'-') if len(mybuildval)==2: try: string.atoi(mybuildval[1]) myval=mybuildval[0] except: return 0 myval=string.split(myval,'.') for x in range(0,len(myval)-1): try: foo=string.atoi(myval[x]) except: return 0 endval=myval[-1:][0] try: string.atoi(endval) return 1 except... |
pos=0 keepgoing=1 while keepgoing: if (pos<len(endval)) and (endval[pos] in "0123456789"): pos=pos+1 else: keepgoing=0 if pos==0: return 0 endval=endval[pos:] if len(endval)==0: | if myval[-1][-1] in "abcdefghijklmnopqrstuvwxyz": try: string.atof(myval[-1][:-1]) return 1 except: pass splits=string.split(myval[-1],"_") if len(splits)!=2: ERRVER="Too many or too few \"_\" characters." return 0 try: string.atof(splits[0]) except: ERRVER=splits[0]+" is not a valid number." return 0 valid=["alpha"... | def ververify(myval): mybuildval=string.split(myval,'-') if len(mybuildval)==2: try: string.atoi(mybuildval[1]) myval=mybuildval[0] except: return 0 myval=string.split(myval,'.') for x in range(0,len(myval)-1): try: foo=string.atoi(myval[x]) except: return 0 endval=myval[-1:][0] try: string.atoi(endval) return 1 except... |
if endval[0] in string.lowercase: if len(endval)>1: return 0 else: return 1 elif endval[0] == "_": endval=endval[1:] mylen=len(endval) if (mylen>=3) and (endval[0:3]=="pre"): if mylen==3: return 1 else: try: string.atoi(endval[3:]) return 1 except: return 0 elif (mylen>=4) and (endval[0:4]=="beta"): if mylen==4: return... | except: ERRVER=secpart+" is not a valid integer." return 0 | def ververify(myval): mybuildval=string.split(myval,'-') if len(mybuildval)==2: try: string.atoi(mybuildval[1]) myval=mybuildval[0] except: return 0 myval=string.split(myval,'.') for x in range(0,len(myval)-1): try: foo=string.atoi(myval[x]) except: return 0 endval=myval[-1:][0] try: string.atoi(endval) return 1 except... |
def prepare_db(mycategory,mypackage): if not os.path.isdir(root+"var"): | def prep_dbdir(): if not os.path.isdir(root+"var"): | def prepare_db(mycategory,mypackage): if not os.path.isdir(root+"var"): os.mkdir(root+"var",0755) if not os.path.isdir(root+"var/db"): os.mkdir(root+"var/db",0755) if not os.path.isdir(root+"var/db/pkg"): os.mkdir(root+"var/db/pkg",0755) if not os.path.isdir(root+"var/db/pkg/"+mycategory): os.mkdir(root+"var/db/pkg/"+m... |
if not os.path.isdir(root+"var/db/pkg/"+mycategory): os.mkdir(root+"var/db/pkg/"+mycategory,0755) if not os.path.isdir(root+"var/db/pkg/"+mycategory+"/"+mypackage): os.mkdir(root+"var/db/pkg/"+mycategory+"/"+mypackage,0755) | def prepare_db(mycategory,mypackage): if not os.path.isdir(root+"var"): os.mkdir(root+"var",0755) if not os.path.isdir(root+"var/db"): os.mkdir(root+"var/db",0755) if not os.path.isdir(root+"var/db/pkg"): os.mkdir(root+"var/db/pkg",0755) if not os.path.isdir(root+"var/db/pkg/"+mycategory): os.mkdir(root+"var/db/pkg/"+m... | |
prepare_db(mycategory,mypackage) | prep_dbdir() if not os.path.isdir(root+"var/db/pkg/"+mycategory): os.mkdir(root+"var/db/pkg/"+mycategory,0755) if not os.path.isdir(root+"var/db/pkg/"+mycategory+"/"+mypackage): os.mkdir(root+"var/db/pkg/"+mycategory+"/"+mypackage,0755) | def merge(mycategory,mypackage,mystart): mystart=os.path.normpath(mystart) os.chdir(mystart) print print ">>> Merging contents of",mystart,"to "+root print ">>> Logging merge to "+root+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS" if not os.path.exists(root): os.makedirs(root,0700) elif not os.path.isdir(root): pr... |
mycatpkg2=string.split(mycatpkg,"/") | def isinstalled(mycatpkg): global installcache mycatpkg2=string.split(mycatpkg,"/") if not installcache: installcache=port_insttree() #initialize cache if isjustname(mycatpkg2[1]): if installcache.has_key(mycatpkg): return 1 else: return 0 else: mysplit=pkgsplit(mycatpkg2[1]) mykey=mycatpkg2[0]+"/"+mysplit[0] # name a... | |
the contents of DBDIR. Dictionary format is: | the contents of ROOT/var/db/pkg. Dictionary format is: | def port_insttree(): """ This function builds a dictionary of installed packages on the system, based on the contents of DBDIR. Dictionary format is: mydict["cat/pkg"]=[ ["cat/fullpkgname",["cat","pkg","ver","rev"] ["cat/fullpkgname",["cat","pkg","ver2","rev2"] ] """ installeddict={} dbdir=getsetting("DBDIR") if not o... |
dbdir=getsetting("DBDIR") if not os.path.isdir(dbdir): return | dbdir=root+"var/db/pkg" prep_dbdir() | def port_insttree(): """ This function builds a dictionary of installed packages on the system, based on the contents of DBDIR. Dictionary format is: mydict["cat/pkg"]=[ ["cat/fullpkgname",["cat","pkg","ver","rev"] ["cat/fullpkgname",["cat","pkg","ver2","rev2"] ] """ installeddict={} dbdir=getsetting("DBDIR") if not o... |
global configdefaults, configsettings, currtree, roottree, localtree, porttree | global configdefaults, configsettings, currtree, roottree, localtree, porttree, ebuild_initialized, root | def ebuild_init(): "performs db/variable initialization for the ebuild system. Not required for other scripts." global configdefaults, configsettings, currtree, roottree, localtree, porttree configdefaults=getconfig("/etc/make.defaults") configsettings=getconfig("/etc/make.conf") localtree=vartree("/") if root=="/": #... |
def init(): global root root=getsetting("ROOT") if len(root)==0: root="/" elif root[-1]!="/": root=root+"/" if root != "/": if not os.path.exists(root[:-1]): print "!!! Error: ROOT",root,"does not exist. Please correct this." print "!!! Exiting." print sys.exit(1) elif not os.path.isdir(root[:-1]): print "!!! Error: R... | ebuild_initialized=1 root=getsetting("ROOT") if len(root)==0: root="/" elif root[-1]!="/": root=root+"/" if root != "/": if not os.path.exists(root[:-1]): print "!!! Error: ROOT",root,"does not exist. Please correct this." print "!!! Exiting." print sys.exit(1) elif not os.path.isdir(root[:-1]): print "!!! Error: ROO... | def ebuild_init(): "performs db/variable initialization for the ebuild system. Not required for other scripts." global configdefaults, configsettings, currtree, roottree, localtree, porttree configdefaults=getconfig("/etc/make.defaults") configsettings=getconfig("/etc/make.conf") localtree=vartree("/") if root=="/": #... |
myurls=os.environ["SRC_URI"] | myurls=getenv("SRC_URI") | def gen_archnames(): "generate archive names from URL list" myurls=os.environ["SRC_URI"] a=string.split(myurls) returnme="" for x in a: returnme=returnme+" "+string.split(x,"/")[-1] print "A='"+returnme[1:]+"'" |
newlist.append(dep_listcleanup(x)) | newlist=newlist+dep_listcleanup(x) | def dep_listcleanup(deplist): "remove unnecessary clutter from deplists. Remove multiple list levels, empty lists" newlist=[] if (len(deplist)==1): #remove multiple-depth lists if (type(deplist[0])==types.ListType): for x in deplist[0]: if type(x)==types.ListType: if len(x)!=0: newlist.append(dep_listcleanup(x)) else:... |
os.system("(cd "+mergeroot+"; for x in `find`; do touch $x; done)") | os.system("(cd "+mergeroot+"; for x in `find`; do touch -c $x; done)") | def merge(self,mergeroot,inforoot,mergestart=None,outfile=None): if mergestart==None: origdir=os.getcwd() if not os.path.exists(self.dbdir): self.create() #open contents file if it isn't already open mergestart=mergeroot print ">>> Updating mtimes..." #before merging, it's *very important* to touch all the files !!! o... |
def getname(pkgname): | def getname(self,pkgname): | def getname(pkgname): "returns file location for this particular package" return self.root+"/"+pkgname+".tbz2" |
print "!!! Portage had a problem grabbing dependencies from:" | print print print "!!! Portage had a problem processing this file:" | def doebuild(myebuild,mydo,checkdeps=1,debug=0): global settings if not os.path.exists(myebuild): print "!!!",myebuild,"not found." return 1 if myebuild[-7:]!=".ebuild": print "!!!",myebuild,"does not appear to be an ebuild file." return 1 settings.reset() settings["PORTAGE_DEBUG"]=str(debug) settings["ROOT"]=root sett... |
print "!!! bash output was:" print | print | def doebuild(myebuild,mydo,checkdeps=1,debug=0): global settings if not os.path.exists(myebuild): print "!!!",myebuild,"not found." return 1 if myebuild[-7:]!=".ebuild": print "!!!",myebuild,"does not appear to be an ebuild file." return 1 settings.reset() settings["PORTAGE_DEBUG"]=str(debug) settings["ROOT"]=root sett... |
print "!!! doebuild() aborting." | print "!!! aborting." print | def doebuild(myebuild,mydo,checkdeps=1,debug=0): global settings if not os.path.exists(myebuild): print "!!!",myebuild,"not found." return 1 if myebuild[-7:]!=".ebuild": print "!!!",myebuild,"does not appear to be an ebuild file." return 1 settings.reset() settings["PORTAGE_DEBUG"]=str(debug) settings["ROOT"]=root sett... |
if os.path.exists(dest): os.unlink(dest) a=getstatusoutput("cp -a "+"'"+src+"' '"+dest+"'") | if dest!="/bin/cp": if os.path.exists(dest): os.unlink(dest) a=getstatusoutput("/bin/cp -a "+"'"+src+"' '"+dest+"'") | def movefile(src,dest): """moves a file from src to dest, preserving all permissions and attributes.""" if os.path.exists(dest): os.unlink(dest) a=getstatusoutput("cp -a "+"'"+src+"' '"+dest+"'") os.unlink(src) if a[0]==0: return 1 else: return 0 |
return [string.join(myparts[:-1],"-"),myparts[-1],"0"] | return [string.join(myparts[:-1],"-"),myparts[-1],"r0"] | def pkgsplit(mypkg): global ERRPKG ERRPKG="" myparts=string.split(mypkg,'-') if len(myparts)<2: ERRPKG="Not enough \"-\" characters." return None if revverify(myparts[-1]): if ververify(myparts[-2]): if len(myparts)==2: ERRPKG="Found rev and version, but no package name." return None else: for x in myparts[:-2]: if ver... |
global prevmask | def merge(self,mergeroot,inforoot,mergestart=None,outfile=None): if mergestart==None: origdir=os.getcwd() if not os.path.exists(self.dbdir): self.create() #open contents file if it isn't already open mergestart=mergeroot print ">>> Updating mtimes..." #before merging, it's *very important* to touch all the files !!! o... | |
if not os.path.exists(root): print "!!! Error: ROOT setting points to a non-existent directory. Exiting." return elif not os.path.isdir(root): print "!!! Error: ROOT setting points to a non-directory. Exiting." return | def merge(self,mergeroot,inforoot,mergestart=None,outfile=None): if mergestart==None: origdir=os.getcwd() if not os.path.exists(self.dbdir): self.create() #open contents file if it isn't already open mergestart=mergeroot print ">>> Updating mtimes..." #before merging, it's *very important* to touch all the files !!! o... | |
os.umask(0) | def ebuild_init(): "performs db/variable initialization for the ebuild system. Not required for other scripts." global local_virts, root_virts, roottree, localtree, ebuild_initialized, root, virtuals local_virts=getvirtuals("/") if root=="/": root_virts=local_virts else: root_virts=getvirtuals(root) localtree=vartree... | |
subs['pepindex'] = pyhome + '/peps/' | subs['pepindex'] = pyhome + '/glep/' | def translate(self): html4css1.Writer.translate(self) settings = self.document.settings template = open(settings.pep_template).read() # Substitutions dict for template: subs = {} subs['encoding'] = settings.output_encoding subs['version'] = docutils.__version__ subs['stylesheet'] = ''.join(self.stylesheet) pyhome = set... |
def prepare_db(myroot,mycategory,mypackage): if not os.path.isdir(myroot+"var"): os.mkdir(myroot+"var",0755) if not os.path.isdir(myroot+"var/db"): os.mkdir(myroot+"var/db",0755) if not os.path.isdir(myroot+"var/db/pkg"): os.mkdir(myroot+"var/db/pkg",0755) if not os.path.isdir(myroot+"var/db/pkg/"+mycategory): os.mkdir... | def prepare_db(mycategory,mypackage): if not os.path.isdir(root+"var"): os.mkdir(root+"var",0755) if not os.path.isdir(root+"var/db"): os.mkdir(root+"var/db",0755) if not os.path.isdir(root+"var/db/pkg"): os.mkdir(root+"var/db/pkg",0755) if not os.path.isdir(root+"var/db/pkg/"+mycategory): os.mkdir(root+"var/db/pkg/"+m... | def prepare_db(myroot,mycategory,mypackage): if not os.path.isdir(myroot+"var"): os.mkdir(myroot+"var",0755) if not os.path.isdir(myroot+"var/db"): os.mkdir(myroot+"var/db",0755) if not os.path.isdir(myroot+"var/db/pkg"): os.mkdir(myroot+"var/db/pkg",0755) if not os.path.isdir(myroot+"var/db/pkg/"+mycategory): os.mkdir... |
return [myroot+x[len(cpref)+1:],x[len(cpref):]] | return [root+x[len(cpref)+1:],x[len(cpref):]] | def pathstrip(x,myroot,mystart): cpref=os.path.commonprefix([x,mystart]) return [myroot+x[len(cpref)+1:],x[len(cpref):]] |
def mergefiles(outfile,myroot,mystart): | def mergefiles(outfile,mystart): | def mergefiles(outfile,myroot,mystart): mycurpath=os.getcwd() myfiles=os.listdir(mycurpath) for x in myfiles: floc=pathstrip(os.path.normpath(mycurpath+"/"+x),myroot,mystart) if os.path.islink(x): myto=os.readlink(x) if os.path.exists(floc[0]): if os.path.isdir(floc[0]): print "!!!",floc[0],"->",myto else: os.unlink(fl... |
floc=pathstrip(os.path.normpath(mycurpath+"/"+x),myroot,mystart) | floc=pathstrip(os.path.normpath(mycurpath+"/"+x),mystart) | def mergefiles(outfile,myroot,mystart): mycurpath=os.getcwd() myfiles=os.listdir(mycurpath) for x in myfiles: floc=pathstrip(os.path.normpath(mycurpath+"/"+x),myroot,mystart) if os.path.islink(x): myto=os.readlink(x) if os.path.exists(floc[0]): if os.path.isdir(floc[0]): print "!!!",floc[0],"->",myto else: os.unlink(fl... |
mergefiles(outfile,myroot,mystart) | mergefiles(outfile,mystart) | def mergefiles(outfile,myroot,mystart): mycurpath=os.getcwd() myfiles=os.listdir(mycurpath) for x in myfiles: floc=pathstrip(os.path.normpath(mycurpath+"/"+x),myroot,mystart) if os.path.islink(x): myto=os.readlink(x) if os.path.exists(floc[0]): if os.path.isdir(floc[0]): print "!!!",floc[0],"->",myto else: os.unlink(fl... |
if movefile(x,pathstrip(mycurpath,myroot,mystart)[0]+"/"+x): | if movefile(x,pathstrip(mycurpath,mystart)[0]+"/"+x): | def mergefiles(outfile,myroot,mystart): mycurpath=os.getcwd() myfiles=os.listdir(mycurpath) for x in myfiles: floc=pathstrip(os.path.normpath(mycurpath+"/"+x),myroot,mystart) if os.path.islink(x): myto=os.readlink(x) if os.path.exists(floc[0]): if os.path.isdir(floc[0]): print "!!!",floc[0],"->",myto else: os.unlink(fl... |
if not os.path.exists(pathstrip(mycurpath,myroot,mystart)[0]+"/"+x): if movefile(x,pathstrip(mycurpath,myroot,mystart)[0]+"/"+x): | if not os.path.exists(pathstrip(mycurpath,mystart)[0]+"/"+x): if movefile(x,pathstrip(mycurpath,mystart)[0]+"/"+x): | def mergefiles(outfile,myroot,mystart): mycurpath=os.getcwd() myfiles=os.listdir(mycurpath) for x in myfiles: floc=pathstrip(os.path.normpath(mycurpath+"/"+x),myroot,mystart) if os.path.islink(x): myto=os.readlink(x) if os.path.exists(floc[0]): if os.path.isdir(floc[0]): print "!!!",floc[0],"->",myto else: os.unlink(fl... |
elif isfifo(pathstrip(mycurpath,myroot,mystart)[0]+"/"+x): os.unlink(pathstrip(mycurpath,myroot,mystart)[0]+"/"+x) if movefile(x,pathstrip(mycurpath,myroot,mystart)[0]+"/"+x): | elif isfifo(pathstrip(mycurpath,mystart)[0]+"/"+x): os.unlink(pathstrip(mycurpath,mystart)[0]+"/"+x) if movefile(x,pathstrip(mycurpath,mystart)[0]+"/"+x): | def mergefiles(outfile,myroot,mystart): mycurpath=os.getcwd() myfiles=os.listdir(mycurpath) for x in myfiles: floc=pathstrip(os.path.normpath(mycurpath+"/"+x),myroot,mystart) if os.path.islink(x): myto=os.readlink(x) if os.path.exists(floc[0]): if os.path.isdir(floc[0]): print "!!!",floc[0],"->",myto else: os.unlink(fl... |
def merge(myroot,mycategory,mypackage,mystart): if myroot=="": myroot="/" | def merge(mycategory,mypackage,mystart): | def merge(myroot,mycategory,mypackage,mystart): if myroot=="": myroot="/" mystart=os.path.normpath(mystart) os.chdir(mystart) print print ">>> Merging contents of",mystart,"to "+myroot print ">>> Logging merge to "+myroot+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS" prepare_db(myroot,mycategory,mypackage) outfile... |
print ">>> Merging contents of",mystart,"to "+myroot print ">>> Logging merge to "+myroot+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS" prepare_db(myroot,mycategory,mypackage) outfile=open(myroot+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS","w") mergefiles(outfile,myroot,mystart) | print ">>> Merging contents of",mystart,"to "+root print ">>> Logging merge to "+root+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS" prepare_db(mycategory,mypackage) outfile=open(root+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS","w") mergefiles(outfile,mystart) | def merge(myroot,mycategory,mypackage,mystart): if myroot=="": myroot="/" mystart=os.path.normpath(mystart) os.chdir(mystart) print print ">>> Merging contents of",mystart,"to "+myroot print ">>> Logging merge to "+myroot+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS" prepare_db(myroot,mycategory,mypackage) outfile... |
def unmerge(myroot,category,pkgname): if myroot=="": myroot="/" if os.path.isdir(os.path.normpath(myroot+"var/db/pkg/"+category+"/"+pkgname)): if myroot=="/": | def unmerge(category,pkgname): if os.path.isdir(os.path.normpath(root+"var/db/pkg/"+category+"/"+pkgname)): if root=="/": | def unmerge(myroot,category,pkgname): if myroot=="": myroot="/" if os.path.isdir(os.path.normpath(myroot+"var/db/pkg/"+category+"/"+pkgname)): if myroot=="/": print "Unmerging",pkgname+"..." else: print "Unmerging",pkgname,"from",myroot+"..." print else: print pkgname,"not installed" return try: contents=open(os.path.n... |
print "Unmerging",pkgname,"from",myroot+"..." | print "Unmerging",pkgname,"from",root+"..." | def unmerge(myroot,category,pkgname): if myroot=="": myroot="/" if os.path.isdir(os.path.normpath(myroot+"var/db/pkg/"+category+"/"+pkgname)): if myroot=="/": print "Unmerging",pkgname+"..." else: print "Unmerging",pkgname,"from",myroot+"..." print else: print pkgname,"not installed" return try: contents=open(os.path.n... |
contents=open(os.path.normpath(myroot+"var/db/pkg/"+category+"/"+pkgname+"/CONTENTS")) | contents=open(os.path.normpath(root+"var/db/pkg/"+category+"/"+pkgname+"/CONTENTS")) | def unmerge(myroot,category,pkgname): if myroot=="": myroot="/" if os.path.isdir(os.path.normpath(myroot+"var/db/pkg/"+category+"/"+pkgname)): if myroot=="/": print "Unmerging",pkgname+"..." else: print "Unmerging",pkgname,"from",myroot+"..." print else: print pkgname,"not installed" return try: contents=open(os.path.n... |
mydat[1]=os.path.normpath(myroot+mydat[1][1:]) | mydat[1]=os.path.normpath(root+mydat[1][1:]) | def unmerge(myroot,category,pkgname): if myroot=="": myroot="/" if os.path.isdir(os.path.normpath(myroot+"var/db/pkg/"+category+"/"+pkgname)): if myroot=="/": print "Unmerging",pkgname+"..." else: print "Unmerging",pkgname,"from",myroot+"..." print else: print pkgname,"not installed" return try: contents=open(os.path.n... |
myebuildfile=os.path.normpath(myroot+"var/db/pkg/"+category+"/"+pkgname+"/"+pkgname+".ebuild") | myebuildfile=os.path.normpath(root+"var/db/pkg/"+category+"/"+pkgname+"/"+pkgname+".ebuild") | def unmerge(myroot,category,pkgname): if myroot=="": myroot="/" if os.path.isdir(os.path.normpath(myroot+"var/db/pkg/"+category+"/"+pkgname)): if myroot=="/": print "Unmerging",pkgname+"..." else: print "Unmerging",pkgname,"from",myroot+"..." print else: print pkgname,"not installed" return try: contents=open(os.path.n... |
if os.path.exists(os.path.normpath(myroot+mydest)): | if os.path.exists(os.path.normpath(root+mydest)): | def unmerge(myroot,category,pkgname): if myroot=="": myroot="/" if os.path.isdir(os.path.normpath(myroot+"var/db/pkg/"+category+"/"+pkgname)): if myroot=="/": print "Unmerging",pkgname+"..." else: print "Unmerging",pkgname,"from",myroot+"..." print else: print pkgname,"not installed" return try: contents=open(os.path.n... |
for thing in os.listdir(myroot+"var/db/pkg/"+category+"/"+pkgname): os.unlink(myroot+"var/db/pkg/"+category+"/"+pkgname+"/"+thing) os.rmdir(myroot+"var/db/pkg/"+category+"/"+pkgname) | for thing in os.listdir(root+"var/db/pkg/"+category+"/"+pkgname): os.unlink(root+"var/db/pkg/"+category+"/"+pkgname+"/"+thing) os.rmdir(root+"var/db/pkg/"+category+"/"+pkgname) | def unmerge(myroot,category,pkgname): if myroot=="": myroot="/" if os.path.isdir(os.path.normpath(myroot+"var/db/pkg/"+category+"/"+pkgname)): if myroot=="/": print "Unmerging",pkgname+"..." else: print "Unmerging",pkgname,"from",myroot+"..." print else: print pkgname,"not installed" return try: contents=open(os.path.n... |
if myroot=="/": | if root=="/": | def unmerge(myroot,category,pkgname): if myroot=="": myroot="/" if os.path.isdir(os.path.normpath(myroot+"var/db/pkg/"+category+"/"+pkgname)): if myroot=="/": print "Unmerging",pkgname+"..." else: print "Unmerging",pkgname,"from",myroot+"..." print else: print pkgname,"not installed" return try: contents=open(os.path.n... |
print pkgname,"unmerged from",myroot+"." | print pkgname,"unmerged from",root+"." | def unmerge(myroot,category,pkgname): if myroot=="": myroot="/" if os.path.isdir(os.path.normpath(myroot+"var/db/pkg/"+category+"/"+pkgname)): if myroot=="/": print "Unmerging",pkgname+"..." else: print "Unmerging",pkgname,"from",myroot+"..." print else: print pkgname,"not installed" return try: contents=open(os.path.n... |
if not os.path.isdir("/var/db/pkg/"+mycatpkg[0]): return 0 mypkgs=os.listdir("/var/db/pkg/"+mycatpkg[0]) | if not os.path.isdir(root+"var/db/pkg/"+mycatpkg[0]): return 0 mypkgs=os.listdir(root+"var/db/pkg/"+mycatpkg[0]) | def isinstalled(mycatpkg): mycatpkg=string.split(mycatpkg,"/") if not os.path.isdir("/var/db/pkg/"+mycatpkg[0]): return 0 mypkgs=os.listdir("/var/db/pkg/"+mycatpkg[0]) if isjustname(mycatpkg[1]): # only name specified for x in mypkgs: thispkgname=pkgsplit(x)[0] if mycatpkg[1]==thispkgname: return 1 else: # name and ver... |
mypkgs=os.listdir("/var/db/pkg/"+mycatpkg[0]) | mypkgs=os.listdir(root+"var/db/pkg/"+mycatpkg[0]) | def installedcmp(mycatpkg): """Compares specific mycatpkg ("cat/pkg-1.2") against installed package version. Assumes that mycatpkg is already installed. Make sure it is before calling this. Returns 0 if mycatpkg is installed (exact version). Returns a positive number if an older version is installed, and returns a ne... |
myreturn.append(x[:-1]) | myline=x[:-1] if myline: myreturn.append(myline) | def getelements(self,ename): if not os.path.exists(self.dbdir+"/"+ename): return [] myelement=open(self.dbdir+"/"+ename,"r") mylines=myelement.readlines() myreturn=[] for x in mylines: myreturn.append(x[:-1]) myelement.close() return myreturn |
for entry in os.listdir(dir): path = os.path.join(dir, entry) if ispackage(path): results.extend(map( lambda (m, s), pkg=entry: (pkg + '.' + m, s), index(path))) elif os.path.isfile(path) and entry[-3:] == '.py': results.append((entry[:-3], synopsis(path))) | for key in dir(object): value = getattr(object, key) if not predicate or predicate(value): results.append((key, value)) results.sort() | def index(dir): """Return a list of (module-name, synopsis) pairs for a directory tree.""" results = [] for entry in os.listdir(dir): path = os.path.join(dir, entry) if ispackage(path): results.extend(map( lambda (m, s), pkg=entry: (pkg + '.' + m, s), index(path))) elif os.path.isfile(path) and entry[-3:] == '.py': res... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.