diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-01-09 21:47:44 +0100 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-01-09 21:47:44 +0100 |
| commit | 9358b351e8f1637ff87c9f9195a4b5e546ca2a79 (patch) | |
| tree | 33b46c806cad33de37aecd7b4750aca5bfa1944d | |
| parent | 12cf58d12b969010f3d98b2974d72bbb950b775f (diff) | |
| download | python-apt-9358b351e8f1637ff87c9f9195a4b5e546ca2a79.tar.gz | |
Cleanup: Remove whitespace at the end of line in all python codes.
| -rw-r--r-- | apt/cache.py | 42 | ||||
| -rw-r--r-- | apt/cdrom.py | 2 | ||||
| -rw-r--r-- | apt/debfile.py | 34 | ||||
| -rw-r--r-- | apt/gtk/widgets.py | 52 | ||||
| -rw-r--r-- | apt/package.py | 38 | ||||
| -rw-r--r-- | apt/progress.py | 26 | ||||
| -rw-r--r-- | aptsources/__init__.py | 2 | ||||
| -rw-r--r-- | aptsources/distinfo.py | 22 | ||||
| -rw-r--r-- | aptsources/distro.py | 52 | ||||
| -rw-r--r-- | aptsources/sourceslist.py | 38 | ||||
| -rw-r--r-- | doc/examples/acquire.py | 4 | ||||
| -rwxr-xr-x | doc/examples/build-deps.py | 2 | ||||
| -rwxr-xr-x | doc/examples/deb_inspect.py | 2 | ||||
| -rwxr-xr-x | doc/examples/gui-inst.py | 2 | ||||
| -rw-r--r-- | doc/examples/progress.py | 6 | ||||
| -rwxr-xr-x | doc/examples/recommends.py | 2 | ||||
| -rwxr-xr-x | doc/examples/versiontest.py | 6 | ||||
| -rwxr-xr-x | setup.py | 2 | ||||
| -rw-r--r-- | tests/cache.py | 4 | ||||
| -rw-r--r-- | tests/depcache.py | 2 | ||||
| -rw-r--r-- | tests/lock.py | 6 | ||||
| -rw-r--r-- | tests/pkgproblemresolver.py | 4 | ||||
| -rw-r--r-- | tests/pkgrecords.py | 2 | ||||
| -rw-r--r-- | tests/pkgsrcrecords.py | 2 | ||||
| -rw-r--r-- | tests/test_aptsources.py | 4 | ||||
| -rwxr-xr-x | tests/test_debextract.py | 2 | ||||
| -rwxr-xr-x | utils/get_debian_mirrors.py | 12 | ||||
| -rwxr-xr-x | utils/get_ubuntu_mirrors.py | 10 | ||||
| -rwxr-xr-x | utils/get_ubuntu_mirrors_from_lp.py | 10 |
29 files changed, 196 insertions, 196 deletions
diff --git a/apt/cache.py b/apt/cache.py index 79e58282..530d56a0 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -1,19 +1,19 @@ # cache.py - apt cache abstraction -# +# # Copyright (c) 2005 Canonical -# +# # Author: Michael Vogt <michael.vogt@ubuntu.com> -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -36,7 +36,7 @@ class LockFailedException(IOError): pass class Cache(object): - """ Dictionary-like package cache + """ Dictionary-like package cache This class has all the packages that are available in it's dictionary """ @@ -56,7 +56,7 @@ class Cache(object): if self._callbacks.has_key(name): for callback in self._callbacks[name]: callback() - + def open(self, progress): """ Open the package cache, after that it can be used like a dictionary @@ -83,12 +83,12 @@ class Cache(object): self._dict[pkg.Name] = Package(self._cache, self._depcache, self._records, self._list, self, pkg) - + i += 1 if progress != None: progress.done() self._runCallbacks("cache_post_open") - + def __getitem__(self, key): """ look like a dictionary (get key) """ return self._dict[key] @@ -112,7 +112,7 @@ class Cache(object): def getChanges(self): """ Get the marked changes """ - changes = [] + changes = [] for name in self._dict.keys(): p = self._dict[name] if p.markedUpgrade or p.markedInstall or p.markedDelete or \ @@ -144,7 +144,7 @@ class Cache(object): " return the packages not downloadable packages in reqreinst state " reqreinst = set() for pkg in self: - if (not pkg.candidateDownloadable and + if (not pkg.candidateDownloadable and (pkg._pkg.InstState == apt_pkg.InstStateReInstReq or pkg._pkg.InstState == apt_pkg.InstStateHoldReInstReq)): reqreinst.add(pkg.name) @@ -153,7 +153,7 @@ class Cache(object): def _runFetcher(self, fetcher): # do the actual fetching res = fetcher.Run() - + # now check the result (this is the code from apt-get.cc) failed = False transient = False @@ -228,13 +228,13 @@ class Cache(object): return self._cache.Update(fetchProgress, self._list) finally: os.close(lock) - + def installArchives(self, pm, installProgress): installProgress.startUpdate() res = installProgress.run(pm) installProgress.finishUpdate() return res - + def commit(self, fetchProgress=None, installProgress=None): """ Apply the marked changes to the cache """ # FIXME: @@ -319,7 +319,7 @@ class FilteredCache(object): self._filters = [] def __len__(self): return len(self._filtered) - + def __getitem__(self, key): return self.cache._dict[key] @@ -337,7 +337,7 @@ class FilteredCache(object): if f.apply(self.cache._dict[pkg]): self._filtered[pkg] = 1 break - + def setFilter(self, filter): " set the current active filter " self._filters = [] @@ -361,7 +361,7 @@ class FilteredCache(object): return self.__dict__[key] else: return getattr(self.cache, key) - + def cache_pre_changed(): print "cache pre changed" @@ -413,7 +413,7 @@ if __name__ == "__main__": for pkg in f.keys(): #print c[pkg].name x = f[pkg].name - + print len(f) print "Testing filtered cache (no argument)" @@ -426,5 +426,5 @@ if __name__ == "__main__": for pkg in f.keys(): #print c[pkg].name x = f[pkg].name - + print len(f) diff --git a/apt/cdrom.py b/apt/cdrom.py index 9d4b62cb..c0e57094 100644 --- a/apt/cdrom.py +++ b/apt/cdrom.py @@ -44,4 +44,4 @@ class Cdrom(object): if not line.startswith("#") and cdid in line: return True return False - + diff --git a/apt/debfile.py b/apt/debfile.py index b1d436cd..33785ea0 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -32,7 +32,7 @@ from gettext import gettext as _ VERSION_OUTDATED, VERSION_SAME, VERSION_NEWER) = range(4) - + class NoDebArchiveException(IOError): pass @@ -63,7 +63,7 @@ class DebPackage(object): def __getitem__(self, key): return self._sections[key] - + def filelist(self): """ return the list of files in the deb """ files = [] @@ -105,7 +105,7 @@ class DebPackage(object): if instver != None and apt_pkg.CheckDep(instver,oper,ver) == True: return True return False - + def _satisfyOrGroup(self, or_group): """ try to satisfy the or_group """ @@ -128,7 +128,7 @@ class DebPackage(object): if len(providers) != 1: continue depname = providers[0].name - + # now check if we can satisfy the deps with the candidate(s) # in the cache cand = self._cache[depname] @@ -168,7 +168,7 @@ class DebPackage(object): #print "ver: %s" % ver #print "pkgver: %s " % pkgver #print "oper: %s " % oper - if (pkgver and apt_pkg.CheckDep(pkgver,oper,ver) and + if (pkgver and apt_pkg.CheckDep(pkgver,oper,ver) and not self.replacesRealPkg(pkgname, oper, ver)): self._failureString += _("Conflicts with the installed package '%s'" % cand.name) return True @@ -188,7 +188,7 @@ class DebPackage(object): # check conflicts with virtual pkgs if not self._cache.has_key(depname): - # FIXME: we have to check for virtual replaces here as + # FIXME: we have to check for virtual replaces here as # well (to pass tests/gdebi-test8.deb) if self._cache.isVirtualPackage(depname): for pkg in self._cache.getProvidingPackages(depname): @@ -208,7 +208,7 @@ class DebPackage(object): """ Return list of package names conflicting with this package. - WARNING: This method will is deprecated. Please use the + WARNING: This method will is deprecated. Please use the attribute DebPackage.depends instead. """ return self.conflicts @@ -228,7 +228,7 @@ class DebPackage(object): """ Return list of package names on which this package depends on. - WARNING: This method will is deprecated. Please use the + WARNING: This method will is deprecated. Please use the attribute DebPackage.depends instead. """ return self.depends @@ -249,7 +249,7 @@ class DebPackage(object): """ Return list of virtual packages which are provided by this package. - WARNING: This method will is deprecated. Please use the + WARNING: This method will is deprecated. Please use the attribute DebPackage.provides instead. """ return self.provides @@ -269,7 +269,7 @@ class DebPackage(object): """ Return list of packages which are replaced by this package. - WARNING: This method will is deprecated. Please use the + WARNING: This method will is deprecated. Please use the attribute DebPackage.replaces instead. """ return self.replaces @@ -286,9 +286,9 @@ class DebPackage(object): replaces = property(replaces) def replacesRealPkg(self, pkgname, oper, ver): - """ + """ return True if the deb packages replaces a real (not virtual) - packages named pkgname, oper, ver + packages named pkgname, oper, ver """ self._dbg(3, "replacesPkg() %s %s %s" % (pkgname,oper,ver)) pkgver = None @@ -299,7 +299,7 @@ class DebPackage(object): pkgver = cand.candidateVersion for or_group in self.getReplaces(): for (name, ver, oper) in or_group: - if (name == pkgname and + if (name == pkgname and apt_pkg.CheckDep(pkgver,oper,ver)): self._dbg(3, "we have a replaces in our package for the conflict against '%s'" % (pkgname)) return True @@ -316,7 +316,7 @@ class DebPackage(object): res = False return res - + def compareToVersionInCache(self, useInstalled=True): """ checks if the pkg is already installed or availabe in the cache and if so in what version, returns if the version of the deb @@ -485,14 +485,14 @@ class DscSrcPackage(DebPackage): self.binaries = [pkg.strip() for pkg in line[len("Binary:"):].split(",")] if line.startswith("Version:"): self._sections["Version"] = line[len("Version:"):].strip() - # we are at the end + # we are at the end if line.startswith("-----BEGIN PGP SIGNATURE-"): break s = _("Install Build-Dependencies for " "source package '%s' that builds %s\n" ) % (self.pkgName, " ".join(self.binaries)) self._sections["Description"] = s - + def checkDeb(self): if not self.checkConflicts(): for pkgname in self._installedConflicts: @@ -515,7 +515,7 @@ if __name__ == "__main__": print "Providers for %s :" % vp for pkg in providers: print " %s" % pkg.name - + d = DebPackage(sys.argv[1], cache) print "Deb: %s" % d.pkgname if not d.checkDeb(): diff --git a/apt/gtk/widgets.py b/apt/gtk/widgets.py index 3a15258f..968e2a77 100644 --- a/apt/gtk/widgets.py +++ b/apt/gtk/widgets.py @@ -8,8 +8,8 @@ Copyright (c) 2004,2005 Canonical Ltd. Authors: Michael Vogt <mvo@ubuntu.com> Sebastian Heinlein <glatzor@ubuntu.com> -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. @@ -17,7 +17,7 @@ his program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -44,9 +44,9 @@ class GOpProgress(gobject.GObject, apt.progress.OpProgress): __gsignals__ = {"status-changed":(gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_STRING, gobject.TYPE_INT)), - "status-started":(gobject.SIGNAL_RUN_FIRST, + "status-started":(gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()), - "status-finished":(gobject.SIGNAL_RUN_FIRST, + "status-finished":(gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())} def __init__(self): @@ -70,15 +70,15 @@ class GInstallProgress(gobject.GObject, apt.progress.InstallProgress): __gsignals__ = {"status-changed":(gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_STRING, gobject.TYPE_INT)), - "status-started":(gobject.SIGNAL_RUN_FIRST, + "status-started":(gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()), - "status-timeout":(gobject.SIGNAL_RUN_FIRST, + "status-timeout":(gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()), - "status-error":(gobject.SIGNAL_RUN_FIRST, + "status-error":(gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()), - "status-conffile":(gobject.SIGNAL_RUN_FIRST, + "status-conffile":(gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()), - "status-finished":(gobject.SIGNAL_RUN_FIRST, + "status-finished":(gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())} def __init__(self, term): @@ -146,9 +146,9 @@ class GFetchProgress(gobject.GObject, apt.progress.FetchProgress): __gsignals__ = {"status-changed":(gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_STRING, gobject.TYPE_INT)), - "status-started":(gobject.SIGNAL_RUN_FIRST, + "status-started":(gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()), - "status-finished":(gobject.SIGNAL_RUN_FIRST, + "status-finished":(gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())} def __init__(self): @@ -206,7 +206,7 @@ class GtkAptProgress(gtk.VBox): win.add(progress) progress.show() win.show() - + cache = apt.cache.Cache(progress.open)) cache["xterm"].markDelete() progress.show_terminal(expanded=True) @@ -243,33 +243,33 @@ class GtkAptProgress(gtk.VBox): self._progress_fetch = GFetchProgress() self._progress_fetch.connect("status-changed", self._on_status_changed) self._progress_fetch.connect("status-started", self._on_status_started) - self._progress_fetch.connect("status-finished", + self._progress_fetch.connect("status-finished", self._on_status_finished) self._progress_install = GInstallProgress(self._terminal) self._progress_install.connect("status-changed", self._on_status_changed) - self._progress_install.connect("status-started", + self._progress_install.connect("status-started", self._on_status_started) - self._progress_install.connect("status-finished", + self._progress_install.connect("status-finished", self._on_status_finished) - self._progress_install.connect("status-timeout", + self._progress_install.connect("status-timeout", self._on_status_timeout) - self._progress_install.connect("status-error", + self._progress_install.connect("status-error", self._on_status_timeout) - self._progress_install.connect("status-conffile", + self._progress_install.connect("status-conffile", self._on_status_timeout) self._progress_dpkg_install = GDpkgInstallProgress(self._terminal) self._progress_dpkg_install.connect("status-changed", self._on_status_changed) - self._progress_dpkg_install.connect("status-started", + self._progress_dpkg_install.connect("status-started", self._on_status_started) - self._progress_dpkg_install.connect("status-finished", + self._progress_dpkg_install.connect("status-finished", self._on_status_finished) - self._progress_dpkg_install.connect("status-timeout", + self._progress_dpkg_install.connect("status-timeout", self._on_status_timeout) - self._progress_dpkg_install.connect("status-error", + self._progress_dpkg_install.connect("status-error", self._on_status_timeout) - self._progress_dpkg_install.connect("status-conffile", + self._progress_dpkg_install.connect("status-conffile", self._on_status_timeout) def clear(self): @@ -300,7 +300,7 @@ class GtkAptProgress(gtk.VBox): Return the install progress handler for dpkg """ return self._dpkg_progress_install - + @property def fetch(self): """ @@ -382,7 +382,7 @@ if __name__ == "__main__": pkg.markInstall() apt_progress.show_terminal(True) try: - cache.commit(apt_progress.get_fetch_progress(), + cache.commit(apt_progress.get_fetch_progress(), apt_progress.get_install_progress()) except: pass diff --git a/apt/package.py b/apt/package.py index 70ddbb1a..9e69a6ec 100644 --- a/apt/package.py +++ b/apt/package.py @@ -1,19 +1,19 @@ # package.py - apt package abstraction -# +# # Copyright (c) 2005 Canonical -# +# # Author: Michael Vogt <michael.vogt@ubuntu.com> -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -92,7 +92,7 @@ class Package(object): if ver == None: #print "No version for: %s (Candidate: %s)" % (self._pkg.Name, UseCandidate) return False - + if ver.FileList == None: print "No FileList for: %s " % self._pkg.Name() return False @@ -147,7 +147,7 @@ class Package(object): base_deps.append(BaseDependency(depOr.TargetPkg.Name, depOr.CompType, depOr.TargetVer, (t == "PreDepends"))) depends_list.append(Dependency(base_deps)) return depends_list - + def candidateDependencies(self): """ return a list of candidate dependencies """ candver = self._depcache.GetCandidateVer(self._pkg) @@ -155,7 +155,7 @@ class Package(object): return [] return self._getDependencies(candver) candidateDependencies = property(candidateDependencies) - + def installedDependencies(self): """ return a list of installed dependencies """ ver = self._pkg.CurrentVer @@ -304,7 +304,7 @@ class Package(object): return "" return self._records.LongDesc rawDescription = property(rawDescription) - + def candidateRecord(self): " return the full pkgrecord as string of the candidate version " if not self._lookupRecord(True): @@ -333,7 +333,7 @@ class Package(object): def markedDelete(self): """ Package is marked for delete """ return self._depcache.MarkedDelete(self._pkg) - markedDelete = property(markedDelete) + markedDelete = property(markedDelete) def markedKeep(self): """ Package is marked for keep """ @@ -356,12 +356,12 @@ class Package(object): isInstalled = property(isInstalled) def isUpgradable(self): - """ Package is upgradable """ + """ Package is upgradable """ return self.isInstalled and self._depcache.IsUpgradable(self._pkg) isUpgradable = property(isUpgradable) def isAutoRemovable(self): - """ + """ Package is installed as a automatic dependency and is no longer required """ @@ -411,7 +411,7 @@ class Package(object): def getChangelog(self, uri=None, cancel_lock=None): """ - Download the changelog of the package and return it as unicode + Download the changelog of the package and return it as unicode string uri: Is the uri to the changelog file. The following named variables @@ -442,7 +442,7 @@ class Package(object): # get the src package name src_pkg = self.sourcePackageName - # assume "main" section + # assume "main" section src_section = "main" # use the section of the candidate as a starting point section = self._depcache.GetCandidateVer(self._pkg).Section @@ -454,7 +454,7 @@ class Package(object): try: # try to get the source version of the pkg, this differs # for some (e.g. libnspr4 on ubuntu) - # this feature only works if the correct deb-src are in the + # this feature only works if the correct deb-src are in the # sources.list # otherwise we fall back to the binary version number src_records = apt_pkg.GetPkgSrcRecords() @@ -563,7 +563,7 @@ class Package(object): "site '%s' isTrusted: '%s'"% (self.component, self.archive, self.origin, self.label, self.site, self.trusted) - + def candidateOrigin(self): ver = self._depcache.GetCandidateVer(self._pkg) if not ver: @@ -623,7 +623,7 @@ class Package(object): object as argument """ self._depcache.Commit(fprogress, iprogress) - + # self-test if __name__ == "__main__": diff --git a/apt/progress.py b/apt/progress.py index a8ab76b6..5a7d1a86 100644 --- a/apt/progress.py +++ b/apt/progress.py @@ -1,19 +1,19 @@ # Progress.py - progress reporting classes -# +# # Copyright (c) 2005 Canonical -# +# # Author: Michael Vogt <michael.vogt@ubuntu.com> -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -69,18 +69,18 @@ class FetchProgress(object): dlFailed : "Failed", dlHit : "Hit", dlIgnored : "Ignored"} - + def __init__(self): self.eta = 0.0 self.percent = 0.0 pass - + def start(self): pass - + def stop(self): pass - + def updateStatus(self, uri, descr, shortDescr, status): pass @@ -115,7 +115,7 @@ class TextFetchProgress(FetchProgress): sys.stdout.flush() return True def stop(self): - print "\rDone downloading " + print "\rDone downloading " def mediaChange(self, medium, drive): """ react to media change events """ res = True; @@ -144,7 +144,7 @@ class DumbInstallProgress(object): class InstallProgress(DumbInstallProgress): """ A InstallProgress that is pretty useful. It supports the attributes 'percent' 'status' and callbacks - for the dpkg errors and conffiles and status changes + for the dpkg errors and conffiles and status changes """ def __init__(self): DumbInstallProgress.__init__(self) diff --git a/aptsources/__init__.py b/aptsources/__init__.py index d6b3605c..ddec2bd9 100644 --- a/aptsources/__init__.py +++ b/aptsources/__init__.py @@ -1,5 +1,5 @@ import apt_pkg - + # init the package system apt_pkg.init() diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py index a6c0faf8..42395bc5 100644 --- a/aptsources/distinfo.py +++ b/aptsources/distinfo.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# +# # distinfo.py - provide meta information for distro repositories # # Copyright (c) 2005 Gustavo Noronha Silva @@ -7,17 +7,17 @@ # # Author: Gustavo Noronha Silva <kov@debian.org> # Sebastian Heinlein <glatzor@ubuntu.com> -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -55,7 +55,7 @@ class Template: def has_component(self, comp): ''' Check if the distribution provides the given component ''' return comp in map(lambda c: c.name, self.components) - + def is_mirror(self, url): ''' Check if a given url of a repository is a valid mirror ''' proto, hostname, dir = split_url(url) @@ -190,7 +190,7 @@ class DistInfo: template.match_uri = value elif field == 'MatchURI-%s' % self.arch: template.match_uri = value - elif (field == 'MirrorsFile' or + elif (field == 'MirrorsFile' or field == 'MirrorsFile-%s' % self.arch): if not map_mirror_sets.has_key(value): mirror_set = {} @@ -243,7 +243,7 @@ class DistInfo: if component and not template.has_component(component.name): template.components.append(component) component = None - self.templates.append(template) + self.templates.append(template) if __name__ == "__main__": @@ -257,8 +257,8 @@ if __name__ == "__main__": if template.mirror_set != {}: print "Mirrors: %s" % template.mirror_set.keys() for comp in template.components: - print " %s -%s -%s" % (comp.name, - comp.description, + print " %s -%s -%s" % (comp.name, + comp.description, comp.description_long) for child in template.children: print " %s" % child.description diff --git a/aptsources/distro.py b/aptsources/distro.py index f271bbc4..a94d88ef 100644 --- a/aptsources/distro.py +++ b/aptsources/distro.py @@ -2,20 +2,20 @@ # # Copyright (c) 2004-2007 Canonical Ltd. # 2006-2007 Sebastian Heinlein -# +# # Authors: Sebastian Heinlein <glatzor@ubuntu.com> # Michael Vogt <mvo@debian.org> -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -48,8 +48,8 @@ class Distribution: def get_sources(self, sourceslist): """ - Find the corresponding template, main and child sources - for the distribution + Find the corresponding template, main and child sources + for the distribution """ self.sourceslist = sourceslist @@ -132,7 +132,7 @@ class Distribution: self.used_media = set(media) self.get_mirrors() - + def get_mirrors(self, mirror_template=None): """ Provide a set of mirrors where you can get the distribution from @@ -203,34 +203,34 @@ class Distribution: '''Helper function that handles comaprision of mirror urls that could contain trailing slashes''' return re.match(mir1.strip("/ "), mir2.rstrip("/ ")) - + # Store all available servers: # Name, URI, active mirrors = [] if len(self.used_servers) < 1 or \ (len(self.used_servers) == 1 and \ compare_mirrors(self.used_servers[0], self.main_server)): - mirrors.append([_("Main server"), self.main_server, True]) - mirrors.append([self._get_mirror_name(self.nearest_server), + mirrors.append([_("Main server"), self.main_server, True]) + mirrors.append([self._get_mirror_name(self.nearest_server), self.nearest_server, False]) elif len(self.used_servers) == 1 and not \ compare_mirrors(self.used_servers[0], self.main_server): - mirrors.append([_("Main server"), self.main_server, False]) + mirrors.append([_("Main server"), self.main_server, False]) # Only one server is used server = self.used_servers[0] - # Append the nearest server if it's not already used + # Append the nearest server if it's not already used if not compare_mirrors(server, self.nearest_server): - mirrors.append([self._get_mirror_name(self.nearest_server), + mirrors.append([self._get_mirror_name(self.nearest_server), self.nearest_server, False]) mirrors.append([self._get_mirror_name(server), server, True]) elif len(self.used_servers) > 1: # More than one server is used. Since we don't handle this case - # in the user interface we set "custom servers" to true and - # append a list of all used servers + # in the user interface we set "custom servers" to true and + # append a list of all used servers mirrors.append([_("Main server"), self.main_server, False]) - mirrors.append([self._get_mirror_name(self.nearest_server), + mirrors.append([self._get_mirror_name(self.nearest_server), self.nearest_server, False]) mirrors.append([_("Custom servers"), None, True]) for server in self.used_servers: @@ -242,7 +242,7 @@ class Distribution: return mirrors - def add_source(self, type=None, + def add_source(self, type=None, uri=None, dist=None, comps=None, comment=""): """ Add distribution specific sources @@ -297,7 +297,7 @@ class Distribution: comps_per_dist = {} comps_per_sdist = {} for s in sources: - if s.type == self.binary_type: + if s.type == self.binary_type: if not comps_per_dist.has_key(s.dist): comps_per_dist[s.dist] = set() map(comps_per_dist[s.dist].add, s.comps) @@ -339,9 +339,9 @@ class Distribution: sources = [] sources.extend(self.main_sources) for source in sources: - if comp in source.comps: + if comp in source.comps: source.comps.remove(comp) - if len(source.comps) < 1: + if len(source.comps) < 1: self.sourceslist.remove(source) def change_server(self, uri): @@ -415,10 +415,10 @@ class UbuntuDistribution(Distribution): mirror_template="http://%s.archive.ubuntu.com/ubuntu/") def get_distro(id=None,codename=None,description=None,release=None): - """ + """ Check the currently used distribution and return the corresponding - distriubtion class that supports distro specific features. - + distriubtion class that supports distro specific features. + If no paramter are given the distro will be auto detected via a call to lsb-release """ @@ -431,7 +431,7 @@ def get_distro(id=None,codename=None,description=None,release=None): del pipe (id, codename, description, release) = lsb_info if id == "Ubuntu": - return UbuntuDistribution(id, codename, description, + return UbuntuDistribution(id, codename, description, release) elif id == "Debian": return DebianDistribution(id, codename, description, release) diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index e0f32f8d..4067920a 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -1,28 +1,28 @@ # aptsource.py - Provide an abstraction of the sources.list -# +# # Copyright (c) 2004-2007 Canonical Ltd. # 2004 Michiel Sikkes # 2006-2007 Sebastian Heinlein -# +# # Author: Michiel Sikkes <michiel@eyesopened.nl> # Michael Vogt <mvo@debian.org> # Sebastian Heinlein <glatzor@ubuntu.com> -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA - + import string import gettext import re @@ -81,14 +81,14 @@ class SourceEntry: self.comps = [] # list of available componetns (may empty) self.comment = "" # (optional) comment self.line = line # the original sources.list line - if file == None: + if file == None: file = apt_pkg.Config.FindDir("Dir::Etc")+apt_pkg.Config.Find("Dir::Etc::sourcelist") self.file = file # the file that the entry is located in self.parse(line) self.template = None # type DistInfo.Suite self.children = [] - def __eq__(self, other): + def __eq__(self, other): """ equal operator for two sources.list entries """ return (self.disabled == other.disabled and self.type == other.type and @@ -138,7 +138,7 @@ class SourceEntry: if line[0] == "#": self.disabled = True pieces = string.split(line[1:]) - # if it looks not like a disabled deb line return + # if it looks not like a disabled deb line return if not pieces[0] in ("rpm", "rpm-src", "deb", "deb-src"): self.invalid = True return @@ -185,7 +185,7 @@ class SourceEntry: i += 1 self.line = self.line[i:] else: - # disabled, add a "#" + # disabled, add a "#" if string.strip(self.line)[0] != "#": self.line = "#" + self.line @@ -207,7 +207,7 @@ class SourceEntry: line += " #"+self.comment line += "\n" return line - + class NullMatcher(object): """ a Matcher that does nothing """ def match(self, s): @@ -218,7 +218,7 @@ class SourcesList: def __init__(self, withMatcher=True, matcherPath="/usr/share/python-apt/templates/"): - self.list = [] # the actual SourceEntries Type + self.list = [] # the actual SourceEntries Type if withMatcher: self.matcher = SourceEntryMatcher(matcherPath) else: @@ -251,7 +251,7 @@ class SourcesList: def add(self, type, uri, dist, orig_comps, comment="", pos=-1, file=None): """ Add a new source to the sources.list. - The method will search for existing matching repos and will try to + The method will search for existing matching repos and will try to reuse them as far as possible """ # create a working copy of the component list so that @@ -367,7 +367,7 @@ class SourcesList: # try to avoid checking uninterressting sources if source.template == None: continue - # set up a dict with all used child templates and corresponding + # set up a dict with all used child templates and corresponding # source entries if source.template.child == True: key = source.template @@ -405,12 +405,12 @@ class SourceEntryMatcher: _ = gettext.gettext found = False for template in self.templates: - if (re.search(template.match_uri, source.uri) and + if (re.search(template.match_uri, source.uri) and re.match(template.match_name, source.dist)): found = True source.template = template break - elif (template.is_mirror(source.uri) and + elif (template.is_mirror(source.uri) and re.match(template.match_name, source.dist)): found = True source.template = template @@ -430,7 +430,7 @@ if __name__ == "__main__": mirror = is_mirror("http://archive.ubuntu.com/ubuntu/", "http://de.archive.ubuntu.com/ubuntu/") print "is_mirror(): %s" % mirror - + print is_mirror("http://archive.ubuntu.com/ubuntu", "http://de.archive.ubuntu.com/ubuntu/") print is_mirror("http://archive.ubuntu.com/ubuntu/", diff --git a/doc/examples/acquire.py b/doc/examples/acquire.py index eef6c1f7..939c33a2 100644 --- a/doc/examples/acquire.py +++ b/doc/examples/acquire.py @@ -27,7 +27,7 @@ recs = apt_pkg.GetPkgRecords(cache) list = apt_pkg.GetPkgSourceList() list.ReadMainList() -# show the amount fetch needed for a dist-upgrade +# show the amount fetch needed for a dist-upgrade depcache.Upgrade(True) progress = apt.progress.TextFetchProgress() fetcher = apt_pkg.GetAcquire(progress) @@ -67,7 +67,7 @@ for item in fetcher.Items: if item.Complete == False: print "No error, still nothing downloaded (%s)" % item.ErrorText print - + res = fetcher.Run() print "fetcher.Run() returned: %s" % res diff --git a/doc/examples/build-deps.py b/doc/examples/build-deps.py index 65e35f3d..81a8b408 100755 --- a/doc/examples/build-deps.py +++ b/doc/examples/build-deps.py @@ -3,7 +3,7 @@ import apt_pkg import sys -import sets # only needed for python2.3, python2.4 supports this naively +import sets # only needed for python2.3, python2.4 supports this naively def get_source_pkg(pkg, records, depcache): """ get the source package name of a given package """ diff --git a/doc/examples/deb_inspect.py b/doc/examples/deb_inspect.py index 0befd2bb..b57526c6 100755 --- a/doc/examples/deb_inspect.py +++ b/doc/examples/deb_inspect.py @@ -8,7 +8,7 @@ import os.path 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); diff --git a/doc/examples/gui-inst.py b/doc/examples/gui-inst.py index feefd6ed..9a3b007f 100755 --- a/doc/examples/gui-inst.py +++ b/doc/examples/gui-inst.py @@ -23,7 +23,7 @@ if __name__ == "__main__": win.add(progress) progress.show() win.show() - + cache = apt.cache.Cache(progress.open) if cache["2vcard"].isInstalled: cache["2vcard"].markDelete() diff --git a/doc/examples/progress.py b/doc/examples/progress.py index 2723c382..b90253cb 100644 --- a/doc/examples/progress.py +++ b/doc/examples/progress.py @@ -23,13 +23,13 @@ class TextProgress(apt.OpProgress): class TextFetchProgress(apt.FetchProgress): def __init__(self): pass - + def start(self): pass - + def stop(self): pass - + def updateStatus(self, uri, descr, shortDescr, status): print "UpdateStatus: '%s' '%s' '%s' '%i'" % (uri,descr,shortDescr, status) def pulse(self): diff --git a/doc/examples/recommends.py b/doc/examples/recommends.py index b1094aee..c1a7eb2e 100755 --- a/doc/examples/recommends.py +++ b/doc/examples/recommends.py @@ -19,7 +19,7 @@ for package in cache.Packages: if not current: continue depends = current.DependsList - for (key, attr) in (('Suggests', 'suggested'), + for (key, attr) in (('Suggests', 'suggested'), ('Recommends', 'recommended')): list = depends.get(key, []) for dependency in list: diff --git a/doc/examples/versiontest.py b/doc/examples/versiontest.py index 95f887f2..c4e5f44d 100755 --- a/doc/examples/versiontest.py +++ b/doc/examples/versiontest.py @@ -10,7 +10,7 @@ if len(TestFile) != 1: print "Must have exactly 1 file name"; sys.exit(0); -# Go over the file.. +# Go over the file.. List = open(TestFile[0],"r"); CurLine = 0; while(1): @@ -21,10 +21,10 @@ while(1): Line = string.strip(Line); if len(Line) == 0 or Line[0] == '#': continue; - + Split = re.split("[ \n]",Line); - # Check forward + # 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]), @@ -56,7 +56,7 @@ for template in glob.glob('data/templates/*.info.in'): if sys.argv[1] == "build": build_docs() -setup(name="python-apt", +setup(name="python-apt", version="0.6.17", description="Python bindings for APT", author="APT Development Team", diff --git a/tests/cache.py b/tests/cache.py index 47d9a3b4..afcad00d 100644 --- a/tests/cache.py +++ b/tests/cache.py @@ -1,7 +1,7 @@ #!/usr/bin/env python2.4 # # Test for the pkgCache code -# +# import apt_pkg import sys @@ -26,7 +26,7 @@ def main(): c = ver.Arch d = ver.DependsListStr dl = ver.DependsList - # get all dependencies (a dict of string->list, + # get all dependencies (a dict of string->list, # e.g. "depends:" -> [ver1,ver2,..] for dep in dl.keys(): # get the list of each dependency object diff --git a/tests/depcache.py b/tests/depcache.py index f4821b4f..5c78c3a1 100644 --- a/tests/depcache.py +++ b/tests/depcache.py @@ -1,7 +1,7 @@ #!/usr/bin/env python2.4 # # Test for the DepCache code -# +# import apt_pkg import sys diff --git a/tests/lock.py b/tests/lock.py index 5d2697f1..86d704ea 100644 --- a/tests/lock.py +++ b/tests/lock.py @@ -1,7 +1,7 @@ #!/usr/bin/env python2.4 # # Test for the pkgCache code -# +# import apt_pkg import sys, os @@ -9,7 +9,7 @@ import sys, os if __name__ == "__main__": lock = "/tmp/test.lck" - + apt_pkg.init() # system-lock @@ -44,4 +44,4 @@ if __name__ == "__main__": fd = apt_pkg.GetLock(lock,True) print "Lockfile fd (child): %s" % fd sys.exit(0) - + diff --git a/tests/pkgproblemresolver.py b/tests/pkgproblemresolver.py index 27747e43..0ed32ea6 100644 --- a/tests/pkgproblemresolver.py +++ b/tests/pkgproblemresolver.py @@ -1,7 +1,7 @@ #!/usr/bin/env python2.4 # # Test for the DepCache code -# +# import apt_pkg import sys @@ -29,7 +29,7 @@ def main(): fixer.Protect(pkg) # we first try to resolve the problem # with the package that should be installed - # protected + # protected try: fixer.Resolve(True) except SystemError: diff --git a/tests/pkgrecords.py b/tests/pkgrecords.py index d0616d29..43723569 100644 --- a/tests/pkgrecords.py +++ b/tests/pkgrecords.py @@ -2,7 +2,7 @@ # # Test for the PkgSrcRecords code # it segfaults for python-apt < 0.5.37 -# +# import apt_pkg import sys diff --git a/tests/pkgsrcrecords.py b/tests/pkgsrcrecords.py index 28df3f7c..06c4a1ef 100644 --- a/tests/pkgsrcrecords.py +++ b/tests/pkgsrcrecords.py @@ -2,7 +2,7 @@ # # Test for the PkgSrcRecords code # it segfaults for python-apt < 0.5.37 -# +# import apt_pkg import sys diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py index 49fe6afa..c8d84395 100644 --- a/tests/test_aptsources.py +++ b/tests/test_aptsources.py @@ -60,7 +60,7 @@ class TestAptSources(unittest.TestCase): "multiverse" in entry.comps): found = True self.assertTrue(found) - # test to add something new: multiverse *and* + # 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/", @@ -105,7 +105,7 @@ class TestAptSources(unittest.TestCase): #print dist_templates for d in ["hardy","hardy-security","hardy-updates","intrepid","hardy-backports"]: self.assertTrue(d in dist_templates) - # test enable + # test enable comp = "restricted" distro.enable_component(comp) found = {} diff --git a/tests/test_debextract.py b/tests/test_debextract.py index 53241e92..c080b26e 100755 --- a/tests/test_debextract.py +++ b/tests/test_debextract.py @@ -7,7 +7,7 @@ def Callback(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) -member = "data.tar.lzma" +member = "data.tar.lzma" if len(sys.argv) > 2: member = sys.argv[2] apt_inst.debExtract(open(sys.argv[1]), Callback, member) diff --git a/utils/get_debian_mirrors.py b/utils/get_debian_mirrors.py index ccddf8ed..512731ed 100755 --- a/utils/get_debian_mirrors.py +++ b/utils/get_debian_mirrors.py @@ -2,23 +2,23 @@ # # get_debian_mirrors.py # -# Download the latest list with available mirrors from the Debian +# Download the latest list with available mirrors from the Debian # website and extract the hosts from the raw page # # Copyright (c) 2006 Free Software Foundation Europe # # Author: Sebastian Heinlein <glatzor@ubuntu.com> -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 diff --git a/utils/get_ubuntu_mirrors.py b/utils/get_ubuntu_mirrors.py index 62b18ba6..605edcf5 100755 --- a/utils/get_ubuntu_mirrors.py +++ b/utils/get_ubuntu_mirrors.py @@ -8,17 +8,17 @@ # Copyright (c) 2006 Free Software Foundation Europe # # Author: Sebastian Heinlein <glatzor@ubuntu.com> -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 diff --git a/utils/get_ubuntu_mirrors_from_lp.py b/utils/get_ubuntu_mirrors_from_lp.py index 7d9116f2..1f41e34b 100755 --- a/utils/get_ubuntu_mirrors_from_lp.py +++ b/utils/get_ubuntu_mirrors_from_lp.py @@ -8,17 +8,17 @@ # Copyright (c) 2006 Free Software Foundation Europe # # Author: Sebastian Heinlein <glatzor@ubuntu.com> -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
