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 /apt | |
| parent | 12cf58d12b969010f3d98b2974d72bbb950b775f (diff) | |
| download | python-apt-9358b351e8f1637ff87c9f9195a4b5e546ca2a79.tar.gz | |
Cleanup: Remove whitespace at the end of line in all python codes.
Diffstat (limited to 'apt')
| -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 |
6 files changed, 97 insertions, 97 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) |
