From b147f1846cd26ab25ad925105f52421992395918 Mon Sep 17 00:00:00 2001 From: Ben Finney Date: Fri, 16 May 2008 14:58:00 +1000 Subject: Remove trailing whitespace. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index b8819b31..72fada77 100755 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ for template in glob.glob('data/templates/*.info.in'): source.close() build.close() -setup(name="python-apt", +setup(name="python-apt", version="0.6.17", description="Python bindings for APT", author="APT Development Team", -- cgit v1.2.3 From 0d12af28d4de2745f8831abf0224ceabec693b76 Mon Sep 17 00:00:00 2001 From: Ben Finney Date: Fri, 16 May 2008 18:04:01 +1000 Subject: Fix spaces adjacent to commas and operators, to conform with PEP 8. --- apt/cache.py | 4 ++-- apt/cdrom.py | 2 +- apt/debfile.py | 4 ++-- apt/package.py | 24 ++++++++++++------------ apt/progress.py | 30 +++++++++++++++--------------- aptsources/distinfo.py | 16 ++++++++-------- aptsources/distro.py | 2 +- aptsources/sourceslist.py | 28 ++++++++++++++-------------- doc/examples/acquire.py | 8 ++++---- doc/examples/all_deps.py | 4 ++-- doc/examples/cdrom.py | 2 +- doc/examples/config.py | 32 ++++++++++++++++---------------- doc/examples/configisc.py | 14 +++++++------- doc/examples/deb_inspect.py | 8 ++++---- doc/examples/desc.py | 6 +++--- doc/examples/gui-inst.py | 8 ++++---- doc/examples/indexfile.py | 2 +- doc/examples/inst.py | 4 ++-- doc/examples/metaindex.py | 6 +++--- doc/examples/print_uris.py | 2 +- doc/examples/progress.py | 4 ++-- doc/examples/tagfile.py | 6 +++--- doc/examples/update.py | 2 +- doc/examples/versiontest.py | 24 ++++++++++++------------ setup.py | 35 ++++++++++++++++++----------------- tests/apt-test.py | 2 +- tests/cache.py | 2 +- tests/depcache.py | 4 ++-- tests/lock.py | 6 +++--- tests/memleak.py | 4 ++-- tests/pkgproblemresolver.py | 2 +- tests/pkgrecords.py | 4 ++-- tests/pkgsrcrecords.py | 2 +- tests/refcount.py | 2 +- tests/test_aptsources.py | 18 +++++++++--------- 35 files changed, 162 insertions(+), 161 deletions(-) (limited to 'setup.py') diff --git a/apt/cache.py b/apt/cache.py index 35da7970..3c3a25e5 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -153,7 +153,7 @@ class Cache(object): if item.StatIdle: transient = True continue - errMsg += "Failed to fetch %s %s\n" % (item.DescURI,item.ErrorText) + errMsg += "Failed to fetch %s %s\n" % (item.DescURI, item.ErrorText) failed = True # we raise a exception if the download failed or it was cancelt @@ -371,7 +371,7 @@ if __name__ == "__main__": for d in ["/tmp/pytest", "/tmp/pytest/partial"]: if not os.path.exists(d): os.mkdir(d) - apt_pkg.Config.Set("Dir::Cache::Archives","/tmp/pytest") + apt_pkg.Config.Set("Dir::Cache::Archives", "/tmp/pytest") pm = apt_pkg.GetPackageManager(c._depcache) fetcher = apt_pkg.GetAcquire(apt.progress.TextFetchProgress()) c._fetchArchives(fetcher, pm) diff --git a/apt/cdrom.py b/apt/cdrom.py index 7f9b4776..d6f098db 100644 --- a/apt/cdrom.py +++ b/apt/cdrom.py @@ -18,7 +18,7 @@ class Cdrom(object): self._progress = progress # see if we have a alternative mountpoint if mountpoint is not None: - apt_pkg.Config.Set("Acquire::cdrom::mount",mountpoint) + apt_pkg.Config.Set("Acquire::cdrom::mount", mountpoint) # do not mess with mount points by default if nomount is True: apt_pkg.Config.Set("APT::CDROM::NoMount", "true") diff --git a/apt/debfile.py b/apt/debfile.py index 365847d7..1a64b833 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -34,9 +34,9 @@ class DebPackage(object): """ return the list of files in the deb """ files = [] - def extract_cb(What,Name,Link,Mode,UID,GID,Size,MTime,Major,Minor): + def extract_cb(What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor): #print "%s '%s','%s',%u,%u,%u,%u,%u,%u,%u"\ - # % (What,Name,Link,Mode,UID,GID,Size, MTime, Major, Minor) + # % (What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor) files.append(Name) for member in self._supported_data_members: diff --git a/apt/package.py b/apt/package.py index b771c677..eef598af 100644 --- a/apt/package.py +++ b/apt/package.py @@ -102,7 +102,7 @@ class Package(object): print "No FileList for: %s " % self._pkg.Name() return False f, index = ver.FileList.pop(0) - self._records.Lookup((f,index)) + self._records.Lookup((f, index)) return True @@ -259,11 +259,11 @@ class Package(object): self._records.Lookup(desc_iter.FileList.pop(0)) desc = "" try: - s = unicode(self._records.LongDesc,"utf-8") - except UnicodeDecodeError,e: + s = unicode(self._records.LongDesc, "utf-8") + except UnicodeDecodeError, e: s = _("Invalid unicode in description for '%s' (%s). " - "Please report.") % (self.name,e) - for line in string.split(s,"\n"): + "Please report.") % (self.name, e) + for line in string.split(s, "\n"): tmp = string.strip(line) if tmp == ".": desc += "\n" @@ -380,7 +380,7 @@ class Package(object): def __repr__(self): return "component: '%s' archive: '%s' origin: '%s' label: '%s' " \ - "site '%s' isTrusted: '%s'"% (self.component, self.archive, + "site '%s' isTrusted: '%s'" % (self.component, self.archive, self.origin, self.label, self.site, self.trusted) @@ -389,7 +389,7 @@ class Package(object): if not ver: return None origins = [] - for (verFileIter,index) in ver.FileList: + for (verFileIter, index) in ver.FileList: origins.append(self.Origin(self, verFileIter)) return origins candidateOrigin = property(candidateOrigin) @@ -440,7 +440,7 @@ class Package(object): self.markInstall() else: # FIXME: we may want to throw a exception here - sys.stderr.write("MarkUpgrade() called on a non-upgrable pkg: '%s'\n" %self._pkg.Name) + sys.stderr.write("MarkUpgrade() called on a non-upgrable pkg: '%s'\n" % self._pkg.Name) def commit(self, fprogress, iprogress): """ commit the changes, need a FetchProgress and InstallProgress @@ -477,10 +477,10 @@ if __name__ == "__main__": print "PackageSize: %s " % pkg.packageSize print "Dependencies: %s" % pkg.installedDependencies for dep in pkg.candidateDependencies: - print ",".join(["%s (%s) (%s) (%s)" % (o.name,o.version,o.relation, o.preDepend) for o in dep.or_dependencies]) + print ",".join(["%s (%s) (%s) (%s)" % (o.name, o.version, o.relation, o.preDepend) for o in dep.or_dependencies]) print "arch: %s" % pkg.architecture print "homepage: %s" % pkg.homepage - print "rec: ",pkg.candidateRecord + print "rec: ", pkg.candidateRecord # now test install/remove import apt @@ -491,7 +491,7 @@ if __name__ == "__main__": for name in cache.keys(): pkg = cache[name] if pkg.isUpgradable: - if random.randint(0,1) == 1: + if random.randint(0, 1) == 1: pkg.markInstall(i) print "Broken: %s " % cache._depcache.BrokenCount print "InstCount: %s " % cache._depcache.InstCount @@ -502,7 +502,7 @@ if __name__ == "__main__": print "Randomly remove some packages with AutoFix: %s" % i cache = apt.Cache(progress) for name in cache.keys(): - if random.randint(0,1) == 1: + if random.randint(0, 1) == 1: try: cache[name].markDelete(i) except SystemError: diff --git a/apt/progress.py b/apt/progress.py index 6f72197e..dbad8050 100644 --- a/apt/progress.py +++ b/apt/progress.py @@ -53,7 +53,7 @@ class OpTextProgress(OpProgress): OpProgress.__init__(self) def update(self, percent): - sys.stdout.write("\r%s: %.2i " % (self.subOp,percent)) + sys.stdout.write("\r%s: %.2i " % (self.subOp, percent)) sys.stdout.flush() def done(self): @@ -71,11 +71,11 @@ class FetchProgress(object): dlFailed = 2 dlHit = 3 dlIgnored = 4 - dlStatusStr = {dlDone : "Done", - dlQueued : "Queued", - dlFailed : "Failed", - dlHit : "Hit", - dlIgnored : "Ignored"} + dlStatusStr = {dlDone: "Done", + dlQueued: "Queued", + dlFailed: "Failed", + dlHit: "Hit", + dlIgnored: "Ignored"} def __init__(self): self.eta = 0.0 @@ -134,7 +134,7 @@ class TextFetchProgress(FetchProgress): """ react to media change events """ res = True; print "Media change: please insert the disc labeled \ - '%s' in the drive '%s' and press enter" % (medium,drive) + '%s' in the drive '%s' and press enter" % (medium, drive) s = sys.stdin.readline() if(s == 'c' or s == 'C'): res = false; @@ -174,7 +174,7 @@ class InstallProgress(DumbInstallProgress): (read, write) = os.pipe() self.writefd=write self.statusfd = os.fdopen(read, "r") - fcntl.fcntl(self.statusfd.fileno(), fcntl.F_SETFL,os.O_NONBLOCK) + fcntl.fcntl(self.statusfd.fileno(), fcntl.F_SETFL, os.O_NONBLOCK) self.read = "" self.percent = 0.0 self.status = "" @@ -183,7 +183,7 @@ class InstallProgress(DumbInstallProgress): " called when a error is detected during the install " pass - def conffile(self,current,new): + def conffile(self, current, new): " called when a conffile question from dpkg is detected " pass @@ -195,8 +195,8 @@ class InstallProgress(DumbInstallProgress): if self.statusfd != None: try: while not self.read.endswith("\n"): - self.read += os.read(self.statusfd.fileno(),1) - except OSError, (errno,errstr): + self.read += os.read(self.statusfd.fileno(), 1) + except OSError, (errno, errstr): # resource temporarly unavailable is ignored if errno != EAGAIN and errnor != EWOULDBLOCK: print errstr @@ -204,14 +204,14 @@ class InstallProgress(DumbInstallProgress): s = self.read #print s try: - (status, pkg, percent, status_str) = string.split(s, ":",3) + (status, pkg, percent, status_str) = string.split(s, ":", 3) except ValueError, e: # silently ignore lines that can't be parsed self.read = "" return #print "percent: %s %s" % (pkg, float(percent)/100.0) if status == "pmerror": - self.error(pkg,status_str) + self.error(pkg, status_str) elif status == "pmconffile": # we get a string like this: # 'current-conffile' 'new-conffile' useredited distedited @@ -231,9 +231,9 @@ class InstallProgress(DumbInstallProgress): def waitChild(self): while True: - select.select([self.statusfd],[],[], self.selectTimeout) + select.select([self.statusfd], [], [], self.selectTimeout) self.updateInterface() - (pid, res) = os.waitpid(self.child_pid,os.WNOHANG) + (pid, res) = os.waitpid(self.child_pid, os.WNOHANG) if pid == self.child_pid: break return os.WEXITSTATUS(res) diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py index 4a601be3..57266a49 100644 --- a/aptsources/distinfo.py +++ b/aptsources/distinfo.py @@ -139,8 +139,8 @@ class Repository: def split_url(url): ''' split a given URL into the protocoll, the hostname and the dir part ''' - return map(lambda a,b: a, re.split(":*\/+", url, maxsplit=2), - [None, None, None]) + return map(lambda a, b: a, re.split(":*\/+", url, maxsplit=2), + [None, None, None]) class DistInfo: @@ -167,17 +167,17 @@ class DistInfo: map_mirror_sets = {} dist_fname = "%s/%s.info" % (base_dir, dist) - dist_file = open (dist_fname) + dist_file = open(dist_fname) if not dist_file: return template = None component = None for line in dist_file: - tokens = line.split (':', 1) - if len (tokens) < 2: + tokens = line.split(':', 1) + if len(tokens) < 2: continue - field = tokens[0].strip () - value = tokens[1].strip () + field = tokens[0].strip() + value = tokens[1].strip() if field == 'ChangelogURI': self.changelogs_uri = _(value) elif field == 'MetaReleaseURI': @@ -251,7 +251,7 @@ class DistInfo: template = None if __name__ == "__main__": - d = DistInfo ("Ubuntu", "/usr/share/python-apt/templates") + d = DistInfo("Ubuntu", "/usr/share/python-apt/templates") print d.changelogs_uri for template in d.templates: print "\nSuite: %s" % template.name diff --git a/aptsources/distro.py b/aptsources/distro.py index 962c57bc..f39f6748 100644 --- a/aptsources/distro.py +++ b/aptsources/distro.py @@ -108,7 +108,7 @@ class Distribution: elif source.uri.startswith("cdrom:") and \ source.disabled == True: self.cdrom_sources.append(source) - elif source.type == self.binary_type and \ + elif source.type == self.binary_type and \ source.disabled == False: self.main_sources.append(source) comps.extend(source.comps) diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 57be2a68..dfc0ccb6 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -78,7 +78,7 @@ def uniq(s): class SourceEntry: """ single sources.list entry """ - def __init__(self, line,file=None): + def __init__(self, line, file=None): self.invalid = False # is the source entry valid self.disabled = False # is it disabled ('#' in front) self.type = "" # what type (deb, deb-src) @@ -131,10 +131,10 @@ class SourceEntry: pieces.append(tmp) return pieces - def parse(self,line): + def parse(self, line): """ parse a given sources.list (textual) line and break it up into the field we have """ - line = string.strip(self.line) + line = string.strip(self.line) #print line # check if the source is enabled/disabled if line == "" or line == "#": # empty line @@ -295,11 +295,11 @@ class SourcesList: source.disabled = False return source # there isn't any matching source, so create a new line and parse it - line = "%s %s %s" % (type,uri,dist) + line = "%s %s %s" % (type, uri, dist) for c in comps: line = line + " " + c; if comment != "": - line = "%s #%s\n" %(line,comment) + line = "%s #%s\n" % (line, comment) line = line + "\n" new_entry = SourceEntry(line) if file != None: @@ -317,13 +317,13 @@ class SourcesList: dir = apt_pkg.Config.FindDir("Dir::Etc") file = apt_pkg.Config.Find("Dir::Etc::sourcelist") if os.path.exists(dir+file+backup_ext) and \ - os.path.exists(dir+file): - shutil.copy(dir+file+backup_ext,dir+file) + os.path.exists(dir+file): + shutil.copy(dir+file+backup_ext, dir+file) # now sources.list.d partsdir = apt_pkg.Config.FindDir("Dir::Etc::sourceparts") for file in glob.glob("%s/*.list" % partsdir): if os.path.exists(file+backup_ext): - shutil.copy(file+backup_ext,file) + shutil.copy(file+backup_ext, file) def backup(self, backup_ext=None): """ make a backup of the current source files, if no backup extension @@ -333,16 +333,16 @@ class SourcesList: backup_ext = time.strftime("%y%m%d.%H%M") for source in self.list: if not source.file in already_backuped and os.path.exists(source.file): - shutil.copy(source.file,"%s%s" % (source.file,backup_ext)) + shutil.copy(source.file, "%s%s" % (source.file, backup_ext)) return backup_ext - def load(self,file): + def load(self, file): """ (re)load the current sources """ try: f = open(file, "r") lines = f.readlines() for line in lines: - source = SourceEntry(line,file) + source = SourceEntry(line, file) self.list.append(source) except: print "could not open file '%s'" % file @@ -359,11 +359,11 @@ class SourcesList: header = ("## See sources.list(5) for more information, especialy\n" "# Remember that you can only use http, ftp or file URIs\n" "# CDROMs are managed through the apt-cdrom tool.\n") - open(path,"w").write(header) + open(path, "w").write(header) return for source in self.list: if not files.has_key(source.file): - files[source.file]=open(source.file,"w") + files[source.file] = open(source.file, "w") files[source.file].write(source.str()) for f in files: files[f].close() @@ -406,7 +406,7 @@ class SourceEntryMatcher: f = os.path.basename(f) i = f.find(".info") f = f[0:i] - dist = DistInfo(f,base_dir=matcherPath) + dist = DistInfo(f, base_dir=matcherPath) for template in dist.templates: if template.match_uri != None: self.templates.append(template) diff --git a/doc/examples/acquire.py b/doc/examples/acquire.py index 7bf7d646..e42a9401 100644 --- a/doc/examples/acquire.py +++ b/doc/examples/acquire.py @@ -20,7 +20,7 @@ def get_file(fetcher, uri, destFile): os.chdir(cwd) return False filename = os.path.basename(uri) - os.rename(dir+"/"+filename,destFile) + os.rename(dir+"/"+filename, destFile) # cleanup os.rmdir(dir) os.chdir(cwd) @@ -44,7 +44,7 @@ depcache.Upgrade(True) progress = apt.progress.TextFetchProgress() fetcher = apt_pkg.GetAcquire(progress) pm = apt_pkg.GetPackageManager(depcache) -pm.GetArchives(fetcher,list,recs) +pm.GetArchives(fetcher, list, recs) print "%s (%s)" % (apt_pkg.SizeToStr(fetcher.FetchNeeded), fetcher.FetchNeeded) actiongroup = apt_pkg.GetPkgActionGroup(depcache) for pkg in cache.Packages: @@ -55,7 +55,7 @@ try: os.mkdir("/tmp/pyapt-test/partial") except OSError: pass -apt_pkg.Config.Set("Dir::Cache::archives","/tmp/pyapt-test") +apt_pkg.Config.Set("Dir::Cache::archives", "/tmp/pyapt-test") pkg = cache["3ddesktop"] depcache.MarkInstall(pkg) @@ -70,7 +70,7 @@ print fetcher get_file(fetcher, "ftp://ftp.debian.org/debian/dists/README", "/tmp/lala") -pm.GetArchives(fetcher,list,recs) +pm.GetArchives(fetcher, list, recs) for item in fetcher.Items: print item diff --git a/doc/examples/all_deps.py b/doc/examples/all_deps.py index f4f1741c..37222463 100644 --- a/doc/examples/all_deps.py +++ b/doc/examples/all_deps.py @@ -26,9 +26,9 @@ pkg = c[pkgname] deps = set() -deps = dependencies(c,pkg, deps, "Depends") +deps = dependencies(c, pkg, deps, "Depends") print " ".join(deps) preDeps = set() -preDeps = dependencies(c,pkg, preDeps, "PreDepends") +preDeps = dependencies(c, pkg, preDeps, "PreDepends") print " ".join(preDeps) diff --git a/doc/examples/cdrom.py b/doc/examples/cdrom.py index e54eb763..289b10f1 100644 --- a/doc/examples/cdrom.py +++ b/doc/examples/cdrom.py @@ -16,7 +16,7 @@ print cdrom progress = CdromProgress() -(res,ident) = cdrom.Ident(progress) +(res, ident) = cdrom.Ident(progress) print "ident result is: %s (%s) " % (res, ident) apt_pkg.Config.Set("APT::CDROM::Rename", "True") diff --git a/doc/examples/config.py b/doc/examples/config.py index 337899f0..cd7bcae0 100755 --- a/doc/examples/config.py +++ b/doc/examples/config.py @@ -12,7 +12,7 @@ # This shows how to use the system for configuration and option control. # The other varient is for ISC object config files. See configisc.py. -import apt_pkg,sys,posixpath; +import apt_pkg, sys, posixpath # Create a new empty Configuration object - there is also the system global # configuration object apt_pkg.Config which is used interally by apt-pkg @@ -20,30 +20,30 @@ import apt_pkg,sys,posixpath; # whenever possible.. Cnf = apt_pkg.newConfiguration(); -print "Command line is",sys.argv +print "Command line is", sys.argv # Load the default configuration file, InitConfig() does this better.. -Cnf.Set("config-file","/etc/apt/apt.conf"); # or Cnf["config-file"] = ".."; +Cnf.Set("config-file", "/etc/apt/apt.conf") # or Cnf["config-file"] = ".." if posixpath.exists(Cnf.FindFile("config-file")): - apt_pkg.ReadConfigFile(Cnf,"/etc/apt/apt.conf"); + apt_pkg.ReadConfigFile(Cnf, "/etc/apt/apt.conf") # Merge the command line arguments into the configuration space -Arguments = [('h',"help","help"), - ('v',"version","version"), - ('q',"quiet","quiet","IntLevel"), - ('c',"config-file","","ConfigFile"), - ('o',"option","","ArbItem")] -print "FileNames",apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv); +Arguments = [('h', "help", "help"), + ('v', "version", "version"), + ('q', "quiet", "quiet", "IntLevel"), + ('c', "config-file", "", "ConfigFile"), + ('o', "option", "", "ArbItem")] +print "FileNames", apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv) -print "Quiet level selected is",Cnf.FindI("quiet",0); +print "Quiet level selected is", Cnf.FindI("quiet", 0) # Do some stuff with it -if Cnf.FindB("version",0) == 1: +if Cnf.FindB("version", 0) == 1: print "Version selected - 1.1"; -if Cnf.FindB("help",0) == 1: - print apt_pkg.Package,apt_pkg.Version,"for",apt_pkg.Architecture, \ - "compiled on",apt_pkg.Date,apt_pkg.Time; +if Cnf.FindB("help", 0) == 1: + print apt_pkg.Package, apt_pkg.Version, "for", apt_pkg.Architecture, \ + "compiled on", apt_pkg.Date, apt_pkg.Time print "Hi, I am the help text for this program"; sys.exit(0); @@ -52,4 +52,4 @@ print "No help for you, try -h"; # Print the configuration space print "The Configuration space looks like:"; for I in Cnf.keys(): - print "%s \"%s\";"%(I,Cnf[I]); + print "%s \"%s\";" % (I, Cnf[I]) diff --git a/doc/examples/configisc.py b/doc/examples/configisc.py index 45a9c7f6..4d0d33d4 100755 --- a/doc/examples/configisc.py +++ b/doc/examples/configisc.py @@ -8,32 +8,32 @@ # doc/examples/ftp-archive.conf # or a bind8 config file.. -import apt_pkg,sys,posixpath; +import apt_pkg, sys, posixpath -ConfigFile = apt_pkg.ParseCommandLine(apt_pkg.Config,[],sys.argv); +ConfigFile = apt_pkg.ParseCommandLine(apt_pkg.Config, [], sys.argv) if len(ConfigFile) != 1: print "Must have exactly 1 file name"; sys.exit(0); Cnf = apt_pkg.newConfiguration(); -apt_pkg.ReadConfigFileISC(Cnf,ConfigFile[0]); +apt_pkg.ReadConfigFileISC(Cnf, ConfigFile[0]) # Print the configuration space #print "The Configuration space looks like:"; #for I in Cnf.keys(): -# print "%s \"%s\";"%(I,Cnf[I]); +# print "%s \"%s\";" % (I, Cnf[I]) # bind8 config file.. if Cnf.has_key("Zone"): - print "Zones: ",Cnf.SubTree("zone").List(); + print "Zones: ", Cnf.SubTree("zone").List() for I in Cnf.List("zone"): SubCnf = Cnf.SubTree(I); if SubCnf.Find("type") == "slave": - print "Masters for %s: %s"%(SubCnf.MyTag(),SubCnf.ValueList("masters")); + print "Masters for %s: %s" % (SubCnf.MyTag(), SubCnf.ValueList("masters")) else: print "Tree definitions:"; for I in Cnf.List("tree"): SubCnf = Cnf.SubTree(I); # This could use Find which would eliminate the possibility of exceptions. - print "Subtree %s with sections '%s' and architectures '%s'"%(SubCnf.MyTag(),SubCnf["Sections"],SubCnf["Architectures"]); + print "Subtree %s with sections '%s' and architectures '%s'" % (SubCnf.MyTag(), SubCnf["Sections"], SubCnf["Architectures"]) diff --git a/doc/examples/deb_inspect.py b/doc/examples/deb_inspect.py index 68219d6d..f3e5ae2b 100755 --- a/doc/examples/deb_inspect.py +++ b/doc/examples/deb_inspect.py @@ -7,11 +7,11 @@ import sys import os.path -def Callback(What,Name,Link,Mode,UID,GID,Size,MTime,Major,Minor): +def Callback(What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor): """ callback for debExtract """ - print "%s '%s','%s',%u,%u,%u,%u,%u,%u,%u"\ - % (What,Name,Link,Mode,UID,GID,Size, MTime, Major, Minor); + print "%s '%s','%s',%u,%u,%u,%u,%u,%u,%u" \ + % (What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor) if __name__ == "__main__": @@ -40,7 +40,7 @@ if __name__ == "__main__": print "extracting archive" dir = "/tmp/deb" os.mkdir(dir) - apt_inst.debExtractArchive(open(file),dir) + apt_inst.debExtractArchive(open(file), dir) def visit(arg, dirname, names): print "%s/" % dirname diff --git a/doc/examples/desc.py b/doc/examples/desc.py index 1d43f2f9..f47517cf 100644 --- a/doc/examples/desc.py +++ b/doc/examples/desc.py @@ -3,7 +3,7 @@ import apt_pkg apt_pkg.init() -apt_pkg.Config.Set("APT::Acquire::Translation","de") +apt_pkg.Config.Set("APT::Acquire::Translation", "de") cache = apt_pkg.GetCache() depcache = apt_pkg.GetDepCache(cache) @@ -15,10 +15,10 @@ print cand desc = cand.TranslatedDescription print desc print desc.FileList -(f,index) = desc.FileList.pop(0) +(f, index) = desc.FileList.pop(0) records = apt_pkg.GetPkgRecords(cache) -records.Lookup((f,index)) +records.Lookup((f, index)) desc = records.LongDesc print len(desc) print desc diff --git a/doc/examples/gui-inst.py b/doc/examples/gui-inst.py index edaec455..61db63f8 100755 --- a/doc/examples/gui-inst.py +++ b/doc/examples/gui-inst.py @@ -32,7 +32,7 @@ class GuiFetchProgress(gtk.Window, FetchProgress): self.label.show() self.vbox.pack_start(self.progress) self.vbox.pack_start(self.label) - self.resize(300,100) + self.resize(300, 100) def start(self): print "start" @@ -64,15 +64,15 @@ class TermInstallProgress(InstallProgress, gtk.Window): self.term.show() # check for the child self.reaper = vte.reaper_get() - self.reaper.connect("child-exited",self.child_exited) + self.reaper.connect("child-exited", self.child_exited) self.finished = False box.pack_start(self.term) self.progressbar = gtk.ProgressBar() self.progressbar.show() box.pack_start(self.progressbar) - def child_exited(self,term, pid, status): - print "child_exited: %s %s %s %s" % (self,term,pid,status) + def child_exited(self, term, pid, status): + print "child_exited: %s %s %s %s" % (self, term, pid, status) self.apt_status = posix.WEXITSTATUS(status) self.finished = True diff --git a/doc/examples/indexfile.py b/doc/examples/indexfile.py index d383fd61..22d0b635 100644 --- a/doc/examples/indexfile.py +++ b/doc/examples/indexfile.py @@ -10,7 +10,7 @@ cache = apt_pkg.GetCache() depcache = apt_pkg.GetDepCache(cache) pkg = cache["libimlib2"] cand = depcache.GetCandidateVer(pkg) -for (f,i) in cand.FileList: +for (f, i) in cand.FileList: index = sources.FindIndex(f) print index if index: diff --git a/doc/examples/inst.py b/doc/examples/inst.py index b37ab4cd..723038c1 100644 --- a/doc/examples/inst.py +++ b/doc/examples/inst.py @@ -23,8 +23,8 @@ class TextInstallProgress(InstallProgress): sys.stdout.flush() self.last = self.percent - def conffile(self,current,new): - print "conffile prompt: %s %s" % (current,new) + def conffile(self, current, new): + print "conffile prompt: %s %s" % (current, new) def error(self, errorstr): print "got dpkg error: '%s'" % errorstr diff --git a/doc/examples/metaindex.py b/doc/examples/metaindex.py index 1bce0dba..f00a7e01 100644 --- a/doc/examples/metaindex.py +++ b/doc/examples/metaindex.py @@ -9,7 +9,7 @@ sources.ReadMainList() for metaindex in sources.List: print metaindex - print "URI: ",metaindex.URI - print "Dist: ",metaindex.Dist - print "IndexFiles: ","\n".join([str(i) for i in metaindex.IndexFiles]) + print "URI: ", metaindex.URI + print "Dist: ", metaindex.Dist + print "IndexFiles: ", "\n".join([str(i) for i in metaindex.IndexFiles]) print diff --git a/doc/examples/print_uris.py b/doc/examples/print_uris.py index 3c93a668..3b678e83 100755 --- a/doc/examples/print_uris.py +++ b/doc/examples/print_uris.py @@ -15,7 +15,7 @@ for pkg in upgradable: pkg._lookupRecord(True) path = apt_pkg.ParseSection(pkg._records.Record)["Filename"] cand = pkg._depcache.GetCandidateVer(pkg._pkg) - for (packagefile,i) in cand.FileList: + for (packagefile, i) in cand.FileList: indexfile = cache._list.FindIndex(packagefile) if indexfile: uri = indexfile.ArchiveURI(path) diff --git a/doc/examples/progress.py b/doc/examples/progress.py index d8f00a52..70fc92f3 100644 --- a/doc/examples/progress.py +++ b/doc/examples/progress.py @@ -34,7 +34,7 @@ class TextFetchProgress(apt.FetchProgress): pass def updateStatus(self, uri, descr, shortDescr, status): - print "UpdateStatus: '%s' '%s' '%s' '%i'" % (uri,descr,shortDescr, status) + print "UpdateStatus: '%s' '%s' '%s' '%i'" % (uri, descr, shortDescr, status) def pulse(self): print "Pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % (SizeToStr(self.currentCPS), SizeToStr(self.currentBytes), SizeToStr(self.totalBytes), self.currentItems, self.totalItems) @@ -86,7 +86,7 @@ class TextCdromProgress(apt.CdromProgress): def changeCdrom(self): print "Please insert cdrom and press " - answer = sys.stdin.readline() + answer = sys.stdin.readline() return True diff --git a/doc/examples/tagfile.py b/doc/examples/tagfile.py index aeba34d2..4faf08ac 100755 --- a/doc/examples/tagfile.py +++ b/doc/examples/tagfile.py @@ -1,8 +1,8 @@ #!/usr/bin/env python import apt_pkg -Parse = apt_pkg.ParseTagFile(open("/var/lib/dpkg/status","r")); +Parse = apt_pkg.ParseTagFile(open("/var/lib/dpkg/status", "r")) while Parse.Step() == 1: - print Parse.Section.get("Package"); - print apt_pkg.ParseDepends(Parse.Section.get("Depends","")); + print Parse.Section.get("Package") + print apt_pkg.ParseDepends(Parse.Section.get("Depends", "")) diff --git a/doc/examples/update.py b/doc/examples/update.py index be7bb679..364fa1c9 100755 --- a/doc/examples/update.py +++ b/doc/examples/update.py @@ -9,5 +9,5 @@ if __name__ == "__main__": "touch /tmp/update-was-run") c = apt.Cache() res = c.update(apt.progress.TextFetchProgress()) - print "res: ",res + print "res: ", res assert(os.path.exists("/tmp/update-about-to-run")) diff --git a/doc/examples/versiontest.py b/doc/examples/versiontest.py index 8f18f6c8..29da3b8f 100755 --- a/doc/examples/versiontest.py +++ b/doc/examples/versiontest.py @@ -1,17 +1,17 @@ #!/usr/bin/python # This is a simple clone of tests/versiontest.cc -import apt_pkg,sys,re,string; +import apt_pkg, sys, re, string apt_pkg.InitConfig(); apt_pkg.InitSystem(); -TestFile = apt_pkg.ParseCommandLine(apt_pkg.Config,[],sys.argv); +TestFile = apt_pkg.ParseCommandLine(apt_pkg.Config, [], sys.argv) if len(TestFile) != 1: print "Must have exactly 1 file name"; sys.exit(0); # Go over the file.. -List = open(TestFile[0],"r"); +List = open(TestFile[0], "r") CurLine = 0; while(1): Line = List.readline(); @@ -22,15 +22,15 @@ while(1): if len(Line) == 0 or Line[0] == '#': continue; - Split = re.split("[ \n]",Line); + Split = re.split("[ \n]", Line) # Check forward - if apt_pkg.VersionCompare(Split[0],Split[1]) != int(Split[2]): - print "Comparision failed on line %u. '%s' ? '%s' %i != %i"%(CurLine, - Split[0],Split[1],apt_pkg.VersionCompare(Split[0],Split[1]), - int(Split[2])); + if apt_pkg.VersionCompare(Split[0], Split[1]) != int(Split[2]): + print "Comparision failed on line %u. '%s' ? '%s' %i != %i" % (CurLine, + Split[0], Split[1], apt_pkg.VersionCompare(Split[0], Split[1]), + int(Split[2])) # Check reverse - if apt_pkg.VersionCompare(Split[1],Split[0]) != -1*int(Split[2]): - print "Comparision failed on line %u. '%s' ? '%s' %i != %i"%(CurLine, - Split[1],Split[0],apt_pkg.VersionCompare(Split[1],Split[0]), - -1*int(Split[2])); + if apt_pkg.VersionCompare(Split[1], Split[0]) != -1 * int(Split[2]): + print "Comparision failed on line %u. '%s' ? '%s' %i != %i" % (CurLine, + Split[1], Split[0], apt_pkg.VersionCompare(Split[1], Split[0]), + -1 * int(Split[2])) diff --git a/setup.py b/setup.py index 72fada77..2c11d9d3 100755 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ apt_pkg = Extension("apt_pkg", files, libraries=["apt-pkg"]); # The apt_inst module files = map(lambda source: "python/"+source, string.split(parse_makefile("python/makefile")["APT_INST_SRC"])) -apt_inst = Extension("apt_inst", files, libraries=["apt-pkg","apt-inst"]); +apt_inst = Extension("apt_inst", files, libraries=["apt-pkg", "apt-inst"]); # Replace the leading _ that is used in the templates for translation templates = [] @@ -29,19 +29,20 @@ for template in glob.glob('data/templates/*.info.in'): source.close() build.close() -setup(name="python-apt", - version="0.6.17", - description="Python bindings for APT", - author="APT Development Team", - author_email="deity@lists.debian.org", - ext_modules=[apt_pkg,apt_inst], - packages=['apt', 'aptsources'], - data_files = [('share/python-apt/templates', - glob.glob('build/data/templates/*.info')), - ('share/python-apt/templates', - glob.glob('data/templates/*.mirrors'))], - cmdclass = { "build" : build_extra.build_extra, - "build_i18n" : build_i18n.build_i18n }, - license = 'GNU GPL', - platforms = 'posix' - ) +setup( + name="python-apt", + version="0.6.17", + description="Python bindings for APT", + author="APT Development Team", + author_email="deity@lists.debian.org", + ext_modules=[apt_pkg, apt_inst], + packages=['apt', 'aptsources'], + data_files=[('share/python-apt/templates', + glob.glob('build/data/templates/*.info')), + ('share/python-apt/templates', + glob.glob('data/templates/*.mirrors'))], + cmdclass={"build": build_extra.build_extra, + "build_i18n": build_i18n.build_i18n}, + license='GNU GPL', + platforms='posix', + ) diff --git a/tests/apt-test.py b/tests/apt-test.py index 6205cf60..fac2ff43 100644 --- a/tests/apt-test.py +++ b/tests/apt-test.py @@ -20,7 +20,7 @@ if __name__ == "__main__": cache = apt.Cache(progress) for name in cache.keys(): import random - if random.randint(0,1) == 1: + if random.randint(0, 1) == 1: cache[name].markDelete() print "Broken: %s " % cache._depcache.BrokenCount print "DelCount: %s " % cache._depcache.DelCount diff --git a/tests/cache.py b/tests/cache.py index 24732578..4e79eb3e 100644 --- a/tests/cache.py +++ b/tests/cache.py @@ -43,7 +43,7 @@ def main(): j = ver.DependsList pass - print "\r%i/%i=%.3f%% " % (i,all,(float(i)/float(all)*100)), + print "\r%i/%i=%.3f%% " % (i, all, (float(i) / float(all) * 100)), if __name__ == "__main__": diff --git a/tests/depcache.py b/tests/depcache.py index 32c510f0..5ed54895 100644 --- a/tests/depcache.py +++ b/tests/depcache.py @@ -31,8 +31,8 @@ def main(): if depcache.MarkedInstall(p): depcache.MarkKeep(p) if depcache.InstCount != 0: - print "Error undoing the selection for %s (InstCount: %s)" % (x,depcache.InstCount) - print "\r%i/%i=%.3f%% " % (i,all,(float(i)/float(all)*100)), + print "Error undoing the selection for %s (InstCount: %s)" % (x, depcache.InstCount) + print "\r%i/%i=%.3f%% " % (i, all, (float(i) / float(all) * 100)), print print "Trying Upgrade:" diff --git a/tests/lock.py b/tests/lock.py index aeab804b..8bd5619f 100644 --- a/tests/lock.py +++ b/tests/lock.py @@ -26,14 +26,14 @@ if __name__ == "__main__": apt_pkg.PkgSystemUnLock() # low-level lock - fd = apt_pkg.GetLock(lock,True) + fd = apt_pkg.GetLock(lock, True) print "Lockfile fd: %s" % fd # try to get lock without error flag pid = os.fork() if pid == 0: # child - fd = apt_pkg.GetLock(lock,False) + fd = apt_pkg.GetLock(lock, False) print "Lockfile fd (child): %s" % fd sys.exit(0) @@ -41,6 +41,6 @@ if __name__ == "__main__": pid = os.fork() if pid == 0: # child - fd = apt_pkg.GetLock(lock,True) + fd = apt_pkg.GetLock(lock, True) print "Lockfile fd (child): %s" % fd sys.exit(0) diff --git a/tests/memleak.py b/tests/memleak.py index 6eece9d4..659091fc 100755 --- a/tests/memleak.py +++ b/tests/memleak.py @@ -15,7 +15,7 @@ for i in range(100): print cache["apt"].name time.sleep(1) gc.collect() - f = open("%s" % i,"w") + f = open("%s" % i, "w") for obj in gc.get_objects(): f.write("%s\n" % str(obj)) f.close() @@ -37,7 +37,7 @@ for i in range(100): dict = {} for pkg in cache.Packages: if len(pkg.VersionList) > 0: - dict[pkg.Name] = apt.Package(cache,depcache, + dict[pkg.Name] = apt.Package(cache, depcache, records, list, None, pkg) print cache["apt"] diff --git a/tests/pkgproblemresolver.py b/tests/pkgproblemresolver.py index 82186d40..7d5ae682 100644 --- a/tests/pkgproblemresolver.py +++ b/tests/pkgproblemresolver.py @@ -49,7 +49,7 @@ def main(): depcache.MarkKeep(p) if depcache.InstCount != 0: print "Error undoing the selection for %s" % x - print "\r%i/%i=%.3f%% " % (i,all,(float(i)/float(all)*100)), + print "\r%i/%i=%.3f%% " % (i, all, (float(i) / float(all) * 100)), print print "Trying Upgrade:" diff --git a/tests/pkgrecords.py b/tests/pkgrecords.py index 72096463..e128237b 100644 --- a/tests/pkgrecords.py +++ b/tests/pkgrecords.py @@ -25,12 +25,12 @@ def main(): if not version: continue file, index = version.FileList.pop(0) - if records.Lookup((file,index)): + if records.Lookup((file, index)): #print records.FileName x = records.FileName y = records.LongDesc pass - print "\r%i/%i=%.3f%% " % (i,cache.PackageCount, (float(i)/float(cache.PackageCount)*100)), + print "\r%i/%i=%.3f%% " % (i, cache.PackageCount, (float(i) / float(cache.PackageCount) * 100)), if __name__ == "__main__": diff --git a/tests/pkgsrcrecords.py b/tests/pkgsrcrecords.py index 3eb0fcab..6e78858b 100644 --- a/tests/pkgsrcrecords.py +++ b/tests/pkgsrcrecords.py @@ -19,7 +19,7 @@ def main(): if src.Lookup(x.Name): #print src.Package pass - print "\r%i/%i=%.3f%% " % (i,cache.PackageCount, (float(i)/float(cache.PackageCount)*100)), + print "\r%i/%i=%.3f%% " % (i, cache.PackageCount, (float(i) / float(cache.PackageCount) * 100)), if __name__ == "__main__": diff --git a/tests/refcount.py b/tests/refcount.py index f3230bd3..a29744ae 100755 --- a/tests/refcount.py +++ b/tests/refcount.py @@ -1,6 +1,6 @@ #!/usr/bin/python-dbg -from pprint import pprint,pformat +from pprint import pprint, pformat import apt import sys import gc diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py index 08c8194a..9019aa2d 100644 --- a/tests/test_aptsources.py +++ b/tests/test_aptsources.py @@ -13,7 +13,7 @@ class TestAptSources(unittest.TestCase): unittest.TestCase.__init__(self, methodName) apt_pkg.init() apt_pkg.Config.Set("Dir::Etc", os.getcwd()) - apt_pkg.Config.Set("Dir::Etc::sourceparts",".") + apt_pkg.Config.Set("Dir::Etc::sourceparts", ".") def testIsMirror(self): self.assertTrue(aptsources.is_mirror("http://archive.ubuntu.com", @@ -22,7 +22,7 @@ class TestAptSources(unittest.TestCase): "http://ftp.debian.org")) def testSourcesListReading(self): - apt_pkg.Config.Set("Dir::Etc::sourcelist","data/sources.list") + apt_pkg.Config.Set("Dir::Etc::sourcelist", "data/sources.list") sources = aptsources.SourcesList() self.assertEqual(len(sources.list), 6) # test load @@ -31,22 +31,22 @@ class TestAptSources(unittest.TestCase): self.assertEqual(len(sources.list), 6) def testSourcesListAdding(self): - apt_pkg.Config.Set("Dir::Etc::sourcelist","data/sources.list") + apt_pkg.Config.Set("Dir::Etc::sourcelist", "data/sources.list") sources = aptsources.SourcesList() # test to add something that is already there (main) before = copy.deepcopy(sources) - sources.add("deb","http://de.archive.ubuntu.com/ubuntu/", + sources.add("deb", "http://de.archive.ubuntu.com/ubuntu/", "edgy", ["main"]) self.assertTrue(sources.list == before.list) # test to add something that is already there (restricted) before = copy.deepcopy(sources) - sources.add("deb","http://de.archive.ubuntu.com/ubuntu/", + sources.add("deb", "http://de.archive.ubuntu.com/ubuntu/", "edgy", ["restricted"]) self.assertTrue(sources.list == before.list) # test to add something new: multiverse - sources.add("deb","http://de.archive.ubuntu.com/ubuntu/", + sources.add("deb", "http://de.archive.ubuntu.com/ubuntu/", "edgy", ["multiverse"]) found = False @@ -60,7 +60,7 @@ class TestAptSources(unittest.TestCase): # test to add something new: multiverse *and* # something that is already there before = copy.deepcopy(sources) - sources.add("deb","http://de.archive.ubuntu.com/ubuntu/", + sources.add("deb", "http://de.archive.ubuntu.com/ubuntu/", "edgy", ["universe", "something"]) found_universe = 0 @@ -79,7 +79,7 @@ class TestAptSources(unittest.TestCase): self.assertEqual(found_universe, 1) def testDistribution(self): - apt_pkg.Config.Set("Dir::Etc::sourcelist","data/sources.list.testDistribution") + apt_pkg.Config.Set("Dir::Etc::sourcelist", "data/sources.list.testDistribution") sources = aptsources.SourcesList() distro = aptsources.Distribution() distro.get_sources(sources) @@ -89,7 +89,7 @@ class TestAptSources(unittest.TestCase): if s.template: dist_templates.add(s.template.name) #print dist_templates - for d in ["edgy","edgy-security","edgy-updates","hoary","breezy", "breezy-backports"]: + for d in ["edgy", "edgy-security", "edgy-updates", "hoary", "breezy", "breezy-backports"]: self.assertTrue(d in dist_templates) # test enable comp = "restricted" -- cgit v1.2.3 From 04dfb70356fc46a1b4e75f3370a4d64b5cc2d9b4 Mon Sep 17 00:00:00 2001 From: Ben Finney Date: Fri, 16 May 2008 19:27:02 +1000 Subject: Remove redundant semicolons from statements. --- apt/progress.py | 4 ++-- aptsources/sourceslist.py | 2 +- doc/examples/config.py | 12 ++++++------ doc/examples/configisc.py | 14 +++++++------- doc/examples/versiontest.py | 20 ++++++++++---------- setup.py | 4 ++-- 6 files changed, 28 insertions(+), 28 deletions(-) (limited to 'setup.py') diff --git a/apt/progress.py b/apt/progress.py index dbad8050..1f2d4e7c 100644 --- a/apt/progress.py +++ b/apt/progress.py @@ -132,12 +132,12 @@ class TextFetchProgress(FetchProgress): def mediaChange(self, medium, drive): """ react to media change events """ - res = True; + res = True print "Media change: please insert the disc labeled \ '%s' in the drive '%s' and press enter" % (medium, drive) s = sys.stdin.readline() if(s == 'c' or s == 'C'): - res = false; + res = false return res diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index dfc0ccb6..6eb69f6e 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -297,7 +297,7 @@ class SourcesList: # there isn't any matching source, so create a new line and parse it line = "%s %s %s" % (type, uri, dist) for c in comps: - line = line + " " + c; + line = line + " " + c if comment != "": line = "%s #%s\n" % (line, comment) line = line + "\n" diff --git a/doc/examples/config.py b/doc/examples/config.py index cd7bcae0..3a77301b 100755 --- a/doc/examples/config.py +++ b/doc/examples/config.py @@ -18,7 +18,7 @@ import apt_pkg, sys, posixpath # configuration object apt_pkg.Config which is used interally by apt-pkg # routines to control unusual situations. I recommend using the sytem global # whenever possible.. -Cnf = apt_pkg.newConfiguration(); +Cnf = apt_pkg.newConfiguration() print "Command line is", sys.argv @@ -39,17 +39,17 @@ print "Quiet level selected is", Cnf.FindI("quiet", 0) # Do some stuff with it if Cnf.FindB("version", 0) == 1: - print "Version selected - 1.1"; + print "Version selected - 1.1" if Cnf.FindB("help", 0) == 1: print apt_pkg.Package, apt_pkg.Version, "for", apt_pkg.Architecture, \ "compiled on", apt_pkg.Date, apt_pkg.Time - print "Hi, I am the help text for this program"; - sys.exit(0); + print "Hi, I am the help text for this program" + sys.exit(0) -print "No help for you, try -h"; +print "No help for you, try -h" # Print the configuration space -print "The Configuration space looks like:"; +print "The Configuration space looks like:" for I in Cnf.keys(): print "%s \"%s\";" % (I, Cnf[I]) diff --git a/doc/examples/configisc.py b/doc/examples/configisc.py index 4d0d33d4..9a858657 100755 --- a/doc/examples/configisc.py +++ b/doc/examples/configisc.py @@ -13,14 +13,14 @@ import apt_pkg, sys, posixpath ConfigFile = apt_pkg.ParseCommandLine(apt_pkg.Config, [], sys.argv) if len(ConfigFile) != 1: - print "Must have exactly 1 file name"; - sys.exit(0); + print "Must have exactly 1 file name" + sys.exit(0) -Cnf = apt_pkg.newConfiguration(); +Cnf = apt_pkg.newConfiguration() apt_pkg.ReadConfigFileISC(Cnf, ConfigFile[0]) # Print the configuration space -#print "The Configuration space looks like:"; +#print "The Configuration space looks like:" #for I in Cnf.keys(): # print "%s \"%s\";" % (I, Cnf[I]) @@ -28,12 +28,12 @@ apt_pkg.ReadConfigFileISC(Cnf, ConfigFile[0]) if Cnf.has_key("Zone"): print "Zones: ", Cnf.SubTree("zone").List() for I in Cnf.List("zone"): - SubCnf = Cnf.SubTree(I); + SubCnf = Cnf.SubTree(I) if SubCnf.Find("type") == "slave": print "Masters for %s: %s" % (SubCnf.MyTag(), SubCnf.ValueList("masters")) else: - print "Tree definitions:"; + print "Tree definitions:" for I in Cnf.List("tree"): - SubCnf = Cnf.SubTree(I); + SubCnf = Cnf.SubTree(I) # This could use Find which would eliminate the possibility of exceptions. print "Subtree %s with sections '%s' and architectures '%s'" % (SubCnf.MyTag(), SubCnf["Sections"], SubCnf["Architectures"]) diff --git a/doc/examples/versiontest.py b/doc/examples/versiontest.py index 29da3b8f..732eafac 100755 --- a/doc/examples/versiontest.py +++ b/doc/examples/versiontest.py @@ -2,25 +2,25 @@ # This is a simple clone of tests/versiontest.cc import apt_pkg, sys, re, string -apt_pkg.InitConfig(); -apt_pkg.InitSystem(); +apt_pkg.InitConfig() +apt_pkg.InitSystem() TestFile = apt_pkg.ParseCommandLine(apt_pkg.Config, [], sys.argv) if len(TestFile) != 1: - print "Must have exactly 1 file name"; - sys.exit(0); + print "Must have exactly 1 file name" + sys.exit(0) # Go over the file.. List = open(TestFile[0], "r") -CurLine = 0; +CurLine = 0 while(1): - Line = List.readline(); - CurLine = CurLine + 1; + Line = List.readline() + CurLine = CurLine + 1 if Line == "": - break; - Line = string.strip(Line); + break + Line = string.strip(Line) if len(Line) == 0 or Line[0] == '#': - continue; + continue Split = re.split("[ \n]", Line) diff --git a/setup.py b/setup.py index 2c11d9d3..eef54773 100755 --- a/setup.py +++ b/setup.py @@ -9,12 +9,12 @@ import glob, os, string # The apt_pkg module files = map(lambda source: "python/"+source, string.split(parse_makefile("python/makefile")["APT_PKG_SRC"])) -apt_pkg = Extension("apt_pkg", files, libraries=["apt-pkg"]); +apt_pkg = Extension("apt_pkg", files, libraries=["apt-pkg"]) # The apt_inst module files = map(lambda source: "python/"+source, string.split(parse_makefile("python/makefile")["APT_INST_SRC"])) -apt_inst = Extension("apt_inst", files, libraries=["apt-pkg", "apt-inst"]); +apt_inst = Extension("apt_inst", files, libraries=["apt-pkg", "apt-inst"]) # Replace the leading _ that is used in the templates for translation templates = [] -- cgit v1.2.3 From 0432da5b015c8dfa30adb03c9fb9f5a83251acdd Mon Sep 17 00:00:00 2001 From: Ben Finney Date: Fri, 16 May 2008 19:33:49 +1000 Subject: Imports on separate lines, to conform with PEP 8. --- doc/examples/cdrom.py | 3 ++- doc/examples/config.py | 4 +++- doc/examples/configisc.py | 4 +++- doc/examples/gui-inst.py | 4 +++- doc/examples/inst.py | 3 ++- doc/examples/versiontest.py | 6 +++++- setup.py | 4 +++- tests/lock.py | 3 ++- 8 files changed, 23 insertions(+), 8 deletions(-) (limited to 'setup.py') diff --git a/doc/examples/cdrom.py b/doc/examples/cdrom.py index 289b10f1..743220a6 100644 --- a/doc/examples/cdrom.py +++ b/doc/examples/cdrom.py @@ -2,7 +2,8 @@ # example how to deal with the depcache import apt_pkg -import sys, os +import sys +import os import copy from progress import CdromProgress diff --git a/doc/examples/config.py b/doc/examples/config.py index 3a77301b..d0895690 100755 --- a/doc/examples/config.py +++ b/doc/examples/config.py @@ -12,7 +12,9 @@ # This shows how to use the system for configuration and option control. # The other varient is for ISC object config files. See configisc.py. -import apt_pkg, sys, posixpath +import apt_pkg +import sys +import posixpath # Create a new empty Configuration object - there is also the system global # configuration object apt_pkg.Config which is used interally by apt-pkg diff --git a/doc/examples/configisc.py b/doc/examples/configisc.py index 9a858657..03fa2cad 100755 --- a/doc/examples/configisc.py +++ b/doc/examples/configisc.py @@ -8,7 +8,9 @@ # doc/examples/ftp-archive.conf # or a bind8 config file.. -import apt_pkg, sys, posixpath +import apt_pkg +import sys +import posixpath ConfigFile = apt_pkg.ParseCommandLine(apt_pkg.Config, [], sys.argv) diff --git a/doc/examples/gui-inst.py b/doc/examples/gui-inst.py index 61db63f8..c14208ae 100755 --- a/doc/examples/gui-inst.py +++ b/doc/examples/gui-inst.py @@ -4,7 +4,9 @@ import apt import apt_pkg -import sys, os, fcntl +import sys +import os +import fcntl import copy import string import fcntl diff --git a/doc/examples/inst.py b/doc/examples/inst.py index 723038c1..a3a50356 100644 --- a/doc/examples/inst.py +++ b/doc/examples/inst.py @@ -2,7 +2,8 @@ # example how to deal with the depcache import apt -import sys, os +import sys +import os import copy import time diff --git a/doc/examples/versiontest.py b/doc/examples/versiontest.py index 732eafac..dd881f6b 100755 --- a/doc/examples/versiontest.py +++ b/doc/examples/versiontest.py @@ -1,7 +1,11 @@ #!/usr/bin/python # This is a simple clone of tests/versiontest.cc -import apt_pkg, sys, re, string +import apt_pkg +import sys +import re +import string + apt_pkg.InitConfig() apt_pkg.InitSystem() diff --git a/setup.py b/setup.py index eef54773..ae1d46eb 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,9 @@ from distutils.core import setup, Extension from distutils.sysconfig import parse_makefile from DistUtilsExtra.command import * -import glob, os, string +import glob +import os +import string # The apt_pkg module files = map(lambda source: "python/"+source, diff --git a/tests/lock.py b/tests/lock.py index 8bd5619f..d45b3964 100644 --- a/tests/lock.py +++ b/tests/lock.py @@ -4,7 +4,8 @@ # import apt_pkg -import sys, os +import sys +import os if __name__ == "__main__": -- cgit v1.2.3