From fdb6cbdee070ae6671bdb5ed6b8a549aac1d8107 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 7 Feb 2010 20:04:59 +0100 Subject: * Fix some places where the old API was still used: - apt/utils.py: Completely ported, previous one was old-API from Ubuntu. - apt/cache.py: Use the new progress classes instead of the old ones. - apt/package.py: Various smaller issues fixed, probably caused by merge. --- apt/utils.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'apt/utils.py') diff --git a/apt/utils.py b/apt/utils.py index df1d0397..8949c2ab 100644 --- a/apt/utils.py +++ b/apt/utils.py @@ -38,39 +38,39 @@ def get_release_date_from_release_file(path): """ if not path or not os.path.exists(path): return None - tag = apt_pkg.ParseTagFile(open(path)) - tag.Step() - if not tag.Section.has_key("Date"): + tag = apt_pkg.TagFile(open(path)) + tag.step() + if not "Date" in tag.section: return None - date = tag.Section["Date"] - return apt_pkg.StrToTime(date) + date = tag.section["Date"] + return apt_pkg.str_to_time(date) def get_release_filename_for_pkg(cache, pkgname, label, release): " get the release file that provides this pkg " - if not cache.has_key(pkgname): + if pkgname not in cache: return None pkg = cache[pkgname] ver = None # look for the version that comes from the repos with # the given label and origin - for aver in pkg._pkg.VersionList: - if aver == None or aver.FileList == None: + for aver in pkg._pkg.version_list: + if aver == None or aver.file_list == None: continue - for verFile, index in aver.FileList: + for ver_file, index in aver.file_list: #print verFile - if (verFile.Origin == label and - verFile.Label == label and - verFile.Archive == release): + if (ver_file.origin == label and + ver_file.label == label and + ver_file.archive == release): ver = aver if not ver: return None - indexfile = cache._list.FindIndex(ver.FileList[0][0]) - for metaindex in cache._list.List: - for m in metaindex.IndexFiles: + indexfile = cache._list.find_index(ver.file_list[0][0]) + for metaindex in cache._list.list: + for m in metaindex.index_files: if (indexfile and - indexfile.Describe == m.Describe and - indexfile.IsTrusted): - dir = apt_pkg.Config.FindDir("Dir::State::lists") - name = apt_pkg.URItoFileName(metaindex.URI)+"dists_%s_Release" % metaindex.Dist + indexfile.describe == m.describe and + indexfile.is_trusted): + dir = apt_pkg.config.find_dir("Dir::State::lists") + name = apt_pkg.uri_to_filename(metaindex.uri)+"dists_%s_Release" % metaindex.dist return dir+name return None -- cgit v1.2.3 From c8fa835540d60393f2a1168625bf5d5ae01c4538 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 13 Feb 2010 15:34:24 +0100 Subject: python/tagfile.cc: Implement the iterator protocol in TagFile. --- apt/debfile.py | 3 +-- apt/utils.py | 6 +++--- debian/changelog | 2 ++ doc/source/library/apt_pkg.rst | 29 ++++++++++++++++++++++++++--- python/tag.cc | 36 +++++++++++++++++++++++++++++++----- 5 files changed, 63 insertions(+), 13 deletions(-) (limited to 'apt/utils.py') diff --git a/apt/debfile.py b/apt/debfile.py index 65f43f20..e27917d5 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -448,9 +448,8 @@ class DscSrcPackage(DebPackage): fobj = open(file) tagfile = apt_pkg.TagFile(fobj) - sec = tagfile.section try: - while tagfile.step() == 1: + for sec in tagfile: for tag in depends_tags: if not tag in sec: continue diff --git a/apt/utils.py b/apt/utils.py index 8949c2ab..61d5d54f 100644 --- a/apt/utils.py +++ b/apt/utils.py @@ -39,10 +39,10 @@ def get_release_date_from_release_file(path): if not path or not os.path.exists(path): return None tag = apt_pkg.TagFile(open(path)) - tag.step() - if not "Date" in tag.section: + section = tag.next() + if not "Date" in section: return None - date = tag.section["Date"] + date = section["Date"] return apt_pkg.str_to_time(date) def get_release_filename_for_pkg(cache, pkgname, label, release): diff --git a/debian/changelog b/debian/changelog index b09fb684..fe0d3b9a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,8 @@ python-apt (0.7.93.2) UNRELEASED; urgency=low * utils/migrate-0.8.py: - Improve C++ parsing and add apt.progress.old to the modules, reduces false positives. + * python/tagfile.cc: + - Implement the iterator protocol in TagFile. -- Julian Andres Klode Sun, 07 Feb 2010 19:58:40 +0100 diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst index 7989a68a..05b3e1fc 100644 --- a/doc/source/library/apt_pkg.rst +++ b/doc/source/library/apt_pkg.rst @@ -1407,9 +1407,32 @@ section as a string. .. class:: TagFile(file) An object which represents a typical debian control file. Can be used for - Packages, Sources, control, Release, etc. + Packages, Sources, control, Release, etc. Such an object provides two + kinds of API which should not be used together: - An example for working with a TagFile could look like:: + The first API implements the iterator protocol and should be used whenever + possible because it has less side effects than the other one. It may be + used e.g. with a for loop:: + + tagf = apt_pkg.TagFile(open('/var/lib/dpkg/status')) + for section in tagfile: + print section['Package'] + + .. method:: next() + + A TagFile is its own iterator. This method is part of the iterator + protocol and returns a :class:`TagSection` object for the next + section in the file. If there is no further section, this method + raises the :exc:`StopIteration` exception. + + From Python 3 on, this method is not available anymore, and the + global function ``next()`` replaces it. + + The second API uses a shared :class:`TagSection` object which is exposed + through the :attr:`section` attribute. This object is modified by calls + to :meth:`step` and :meth:`jump`. This API provides more control and may + use less memory, but is not recommended because it works by modifying + one object. It can be used like this:: tagf = apt_pkg.TagFile(open('/var/lib/dpkg/status')) tagf.step() @@ -1418,7 +1441,7 @@ section as a string. .. method:: step Step forward to the next section. This simply returns ``1`` if OK, and - ``0`` if there is no section + ``0`` if there is no section. .. method:: offset diff --git a/python/tag.cc b/python/tag.cc index 2aaf3beb..4971a03d 100644 --- a/python/tag.cc +++ b/python/tag.cc @@ -258,6 +258,28 @@ static PyObject *TagFileStep(PyObject *Self,PyObject *Args) return HandleErrors(Py_BuildValue("i",1)); } +// TagFile Wrappers /*{{{*/ +static PyObject *TagFileNext(PyObject *Self) +{ + TagFileData &Obj = *(TagFileData *)Self; + // Replace the section. + Py_CLEAR(Obj.Section); + Obj.Section = (TagSecData*)(&PyTagSection_Type)->tp_alloc(&PyTagSection_Type, 0); + new (&Obj.Section->Object) pkgTagSection(); + Obj.Section->Owner = Self; + Py_INCREF(Obj.Section->Owner); + Obj.Section->Data = 0; + if (Obj.Object.Step(Obj.Section->Object) == false) + return HandleErrors(NULL); + Py_INCREF(Obj.Section); + return HandleErrors(Obj.Section); +} + +static PyObject *TagFileIter(PyObject *Self) { + Py_INCREF(Self); + return Self; +} + static char *doc_Offset = "Offset() -> Integer"; static PyObject *TagFileOffset(PyObject *Self,PyObject *Args) { @@ -541,9 +563,13 @@ static PyGetSetDef TagFileGetSet[] = { static char *doc_TagFile = "TagFile(file) -> TagFile() object. \n\n" "TagFile() objects provide access to debian control files, which consists\n" "of multiple RFC822-like formatted sections.\n\n" - "A file may consists of multiple sections, and you can use Step() to move\n" - "forward. The current TagSection() is available via the attribute section" - ".\n\n" + "To provide access to those sections, TagFile objects provide an iterator\n" + "which yields TagSection objects for each section.\n\n" + "TagFile objects also provide another API which uses a shared TagSection\n" + "object in the 'section' member. The functions step() and jump() can be\n" + "used to navigate in the file; and offset() tells the current position.\n\n" + "It is important to not mix the use of both APIs, because this can have\n" + "unwanted effects.\n\n" "The parameter *file* refers to an object providing a fileno() method or\n" "a file descriptor (an integer)"; @@ -578,8 +604,8 @@ PyTypeObject PyTagFile_Type = TagFileClear, // tp_clear 0, // tp_richcompare 0, // tp_weaklistoffset - 0, // tp_iter - 0, // tp_iternext + TagFileIter, // tp_iter + TagFileNext, // tp_iternext TagFileMethods, // tp_methods 0, // tp_members TagFileGetSet, // tp_getset -- cgit v1.2.3 From 78e152429187ef145124b0ac0a69ffd1d52f4ed7 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 1 Mar 2010 17:12:09 +0100 Subject: Style fixes. --- apt/cache.py | 27 ++++++++++++++------------- apt/package.py | 1 - apt/progress/base.py | 6 ++++-- apt/progress/old.py | 3 ++- apt/utils.py | 14 ++++++++++---- aptsources/distro.py | 2 ++ doc/source/examples/apt-cdrom.py | 3 ++- doc/source/examples/update-print-uris.py | 1 + 8 files changed, 35 insertions(+), 22 deletions(-) (limited to 'apt/utils.py') diff --git a/apt/cache.py b/apt/cache.py index b5733d98..e8688d64 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -46,12 +46,12 @@ class Cache(object): """Dictionary-like package cache. This class has all the packages that are available in it's - dictionary. + dictionary. Keyword arguments: progress -- a OpProgress object - rootdir -- a alternative root directory. if that is given - the system sources.list and system lists/ files are + rootdir -- a alternative root directory. if that is given + the system sources.list and system lists/ files are not read, only files relative to the given rootdir memonly -- build the cache in memory only """ @@ -95,12 +95,12 @@ class Cache(object): "/var/lib/apt/lists/partial", ] for d in dirs: - if not os.path.exists(rootdir+d): - print "creating: ",rootdir+d - os.makedirs(rootdir+d) + if not os.path.exists(rootdir + d): + print "creating: ", rootdir + d + os.makedirs(rootdir + d) for f in files: - if not os.path.exists(rootdir+f): - open(rootdir+f,"w") + if not os.path.exists(rootdir + f): + open(rootdir + f, "w") def _run_callbacks(self, name): """ internal helper to run a callback """ @@ -125,12 +125,12 @@ class Cache(object): self._weakref.clear() progress.op = _("Building data structures") - i=last=0 - size=len(self._cache.packages) + i = last = 0 + size = len(self._cache.packages) for pkg in self._cache.packages: if progress is not None and last+100 < i: progress.update(i/float(size)*100) - last=i + last = i # drop stuff with no versions (cruft) if len(pkg.version_list) > 0: self._set.add(pkg.name) @@ -376,9 +376,10 @@ class Cache(object): elif res == pm.RESULT_FAILED: raise SystemError("installArchives() failed") elif res == pm.RESULT_INCOMPLETE: - pass + pass else: - raise SystemError("internal-error: unknown result code from InstallArchives: %s" % res) + raise SystemError("internal-error: unknown result code " + "from InstallArchives: %s" % res) # reload the fetcher for media swaping fetcher.shutdown() return (res == pm.RESULT_COMPLETED) diff --git a/apt/package.py b/apt/package.py index 84a1f1e6..6bf9554b 100644 --- a/apt/package.py +++ b/apt/package.py @@ -79,7 +79,6 @@ class BaseDependency(object): def __ne__(self, other): return str.__eq__(self, other) and str.__ne__(2 * self, other) - def __init__(self, name, rel, ver, pre, rawtype=None): self.name = name self.relation = len(rel) == 1 and self.__dstr(rel) or rel diff --git a/apt/progress/base.py b/apt/progress/base.py index 8075f790..d4342de8 100644 --- a/apt/progress/base.py +++ b/apt/progress/base.py @@ -197,7 +197,8 @@ class InstallProgress(object): os._exit(obj.do_install(self.write_stream.fileno())) except AttributeError: os._exit(os.spawnlp(os.P_WAIT, "dpkg", "dpkg", "--status-fd", - str(self.write_stream.fileno()), "-i", obj)) + str(self.write_stream.fileno()), "-i", + obj)) except Exception: os._exit(apt_pkg.PackageManager.RESULT_FAILED) @@ -266,7 +267,8 @@ class InstallProgress(object): (pid, res) = (0, 0) while True: try: - select.select([self.status_stream], [], [], self.select_timeout) + select.select([self.status_stream], [], [], + self.select_timeout) except select.error, (errno_, errstr): if errno_ != errno.EINTR: raise diff --git a/apt/progress/old.py b/apt/progress/old.py index 15ead890..b2f6f0d5 100644 --- a/apt/progress/old.py +++ b/apt/progress/old.py @@ -191,7 +191,8 @@ class InstallProgress(DumbInstallProgress, base.InstallProgress): selectTimeout = AttributeDeprecatedBy('select_timeout') statusChange = function_deprecated_by(base.InstallProgress.status_change) - updateInterface = function_deprecated_by(base.InstallProgress.update_interface) + updateInterface = function_deprecated_by( + base.InstallProgress.update_interface) waitChild = function_deprecated_by(base.InstallProgress.wait_child) diff --git a/apt/utils.py b/apt/utils.py index 61d5d54f..dd52f824 100644 --- a/apt/utils.py +++ b/apt/utils.py @@ -17,9 +17,11 @@ # this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -import apt_pkg import os.path +import apt_pkg + + def get_maintenance_end_date(release_date, m_months): """ get the (year, month) tuple when the maintenance for the distribution @@ -28,10 +30,12 @@ def get_maintenance_end_date(release_date, m_months): """ years = m_months / 12 months = m_months % 12 - support_end_year = release_date.year + years + (release_date.month + months)/12 + support_end_year = (release_date.year + years + + (release_date.month + months)/12) support_end_month = (release_date.month + months) % 12 return (support_end_year, support_end_month) + def get_release_date_from_release_file(path): """ return the release date as time_t for the given release file @@ -45,6 +49,7 @@ def get_release_date_from_release_file(path): date = section["Date"] return apt_pkg.str_to_time(date) + def get_release_filename_for_pkg(cache, pkgname, label, release): " get the release file that provides this pkg " if pkgname not in cache: @@ -54,7 +59,7 @@ def get_release_filename_for_pkg(cache, pkgname, label, release): # look for the version that comes from the repos with # the given label and origin for aver in pkg._pkg.version_list: - if aver == None or aver.file_list == None: + if aver is None or aver.file_list is None: continue for ver_file, index in aver.file_list: #print verFile @@ -71,6 +76,7 @@ def get_release_filename_for_pkg(cache, pkgname, label, release): indexfile.describe == m.describe and indexfile.is_trusted): dir = apt_pkg.config.find_dir("Dir::State::lists") - name = apt_pkg.uri_to_filename(metaindex.uri)+"dists_%s_Release" % metaindex.dist + name = (apt_pkg.uri_to_filename(metaindex.uri) + + "dists_%s_Release" % metaindex.dist) return dir+name return None diff --git a/aptsources/distro.py b/aptsources/distro.py index 1e60a0ed..e51fbe9f 100644 --- a/aptsources/distro.py +++ b/aptsources/distro.py @@ -437,6 +437,7 @@ class UbuntuDistribution(Distribution): Distribution.get_mirrors( self, mirror_template="http://%s.archive.ubuntu.com/ubuntu/") + def _lsb_release(): """Call lsb_release --idrc and return a mapping.""" from subprocess import Popen, PIPE @@ -454,6 +455,7 @@ def _lsb_release(): print 'WARNING: lsb_release failed, using defaults:', exc return result + def get_distro(id=None, codename=None, description=None, release=None): """ Check the currently used distribution and return the corresponding diff --git a/doc/source/examples/apt-cdrom.py b/doc/source/examples/apt-cdrom.py index a20b0f12..cb23e97d 100644 --- a/doc/source/examples/apt-cdrom.py +++ b/doc/source/examples/apt-cdrom.py @@ -30,7 +30,8 @@ def show_help(): " -f Fast mode, don't check package files\n" " -a Thorough scan mode\n" " -c=? Read this configuration file\n" - " -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n" + " -o=? Set an arbitrary configuration option, eg -o " + "dir::cache=/tmp\n" "See fstab(5)") return 0 diff --git a/doc/source/examples/update-print-uris.py b/doc/source/examples/update-print-uris.py index f078cdc5..dbe1dfde 100644 --- a/doc/source/examples/update-print-uris.py +++ b/doc/source/examples/update-print-uris.py @@ -4,6 +4,7 @@ This behaves somewhat like apt-get --print-uris update.""" import apt_pkg + def main(): apt_pkg.init_config() apt_pkg.init_system() -- cgit v1.2.3 From a8dda6d93b07b7226a3aa41baa50ca059674566e Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 1 Mar 2010 17:48:06 +0100 Subject: Some stylistic changes. --- apt/cache.py | 10 +++++++--- apt/debfile.py | 22 +++++++++++----------- apt/progress/base.py | 9 +++------ apt/progress/gtk2.py | 1 + apt/progress/old.py | 10 ++++++++++ apt/utils.py | 6 +++--- 6 files changed, 35 insertions(+), 23 deletions(-) (limited to 'apt/utils.py') diff --git a/apt/cache.py b/apt/cache.py index e8688d64..2e6d24e5 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -57,6 +57,10 @@ class Cache(object): """ def __init__(self, progress=None, rootdir=None, memonly=False): + self._cache = None + self._depcache = None + self._records = None + self._list = None self._callbacks = {} self._weakref = weakref.WeakValueDictionary() self._set = set() @@ -624,9 +628,9 @@ def _test(): # see if fetching works - for dir in ["/tmp/pytest", "/tmp/pytest/partial"]: - if not os.path.exists(dir): - os.mkdir(dir) + for dirname in ["/tmp/pytest", "/tmp/pytest/partial"]: + if not os.path.exists(dirname): + os.mkdir(dirname) apt_pkg.config.set("Dir::Cache::Archives", "/tmp/pytest") pm = apt_pkg.PackageManager(cache._depcache) fetcher = apt_pkg.Acquire(apt.progress.text.AcquireProgress()) diff --git a/apt/debfile.py b/apt/debfile.py index e27917d5..ccaa25e4 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -43,6 +43,9 @@ class DebPackage(object): def __init__(self, filename=None, cache=None): self._cache = cache self._need_pkgs = [] + self._debfile = None + self.pkgname = "" + self.filename = filename self._sections = {} self._installed_conflicts = set() self._failure_string = "" @@ -168,9 +171,6 @@ class DebPackage(object): """Check the or-group for conflicts with installed pkgs.""" self._dbg(2, "_check_conflicts_or_group(): %s " % (or_group)) - or_found = False - virtual_pkg = None - for dep in or_group: depname = dep[0] ver = dep[1] @@ -287,13 +287,13 @@ class DebPackage(object): else: cachever = self._cache[pkgname].candidate.version if cachever is not None: - cmp = apt_pkg.version_compare(cachever, debver) - self._dbg(1, "CompareVersion(debver,instver): %s" % cmp) - if cmp == 0: + cmpres = apt_pkg.version_compare(cachever, debver) + self._dbg(1, "CompareVersion(debver,instver): %s" % cmpres) + if cmpres == 0: return VERSION_SAME - elif cmp < 0: + elif cmpres < 0: return VERSION_NEWER - elif cmp > 0: + elif cmpres > 0: return VERSION_OUTDATED return VERSION_NONE @@ -361,7 +361,7 @@ class DebPackage(object): for pkg in self._need_pkgs: try: self._cache[pkg].mark_install(fromUser=False) - except SystemError, e: + except SystemError: self._failure_string = _("Cannot install '%s'" % pkg) self._cache.clear() return False @@ -427,7 +427,8 @@ class DscSrcPackage(DebPackage): DebPackage.__init__(self, None, cache) self._depends = [] self._conflicts = [] - self._binaries = [] + self.pkgname = "" + self.binaries = [] if filename is not None: self.open(filename) @@ -465,7 +466,6 @@ class DscSrcPackage(DebPackage): if 'Version' in sec: self._sections['Version'] = sec['Version'] finally: - del sec del tagfile fobj.close() diff --git a/apt/progress/base.py b/apt/progress/base.py index d4342de8..6822b74a 100644 --- a/apt/progress/base.py +++ b/apt/progress/base.py @@ -16,6 +16,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA +# pylint: disable-msg = R0201 """Base classes for progress reporting. Custom progress classes should inherit from these classes. They can also be @@ -28,7 +29,6 @@ import re import select import apt_pkg -from apt.deprecation import function_deprecated_by __all__ = ['AcquireProgress', 'CdromProgress', 'InstallProgress', 'OpProgress'] @@ -137,7 +137,7 @@ class CdromProgress(object): class InstallProgress(object): """Class to report the progress of installing packages.""" - percent, select_timeout, status = 0.0, 0.1, "" + child_pid, percent, select_timeout, status = 0, 0.0, 0.1, "" def __init__(self): (self.statusfd, self.writefd) = os.pipe() @@ -159,9 +159,6 @@ class InstallProgress(object): def status_change(self, pkg, percent, status): """(Abstract) Called when the APT status changed.""" - # compat with 0.7 - if apt_pkg._COMPAT_0_7 and hasattr(self, "statusChange"): - self.statusChange(pkg, percent, status) def dpkg_status_change(self, pkg, status): """(Abstract) Called when the dpkg status changed.""" @@ -269,7 +266,7 @@ class InstallProgress(object): try: select.select([self.status_stream], [], [], self.select_timeout) - except select.error, (errno_, errstr): + except select.error, (errno_, _errstr): if errno_ != errno.EINTR: raise diff --git a/apt/progress/gtk2.py b/apt/progress/gtk2.py index 29e730a3..acb01eed 100644 --- a/apt/progress/gtk2.py +++ b/apt/progress/gtk2.py @@ -124,6 +124,7 @@ class GInstallProgress(gobject.GObject, base.InstallProgress): base.InstallProgress.__init__(self) gobject.GObject.__init__(self) self.finished = False + self.apt_status = -1 self.time_last_update = time.time() self.term = term reaper = vte.reaper_get() diff --git a/apt/progress/old.py b/apt/progress/old.py index b2f6f0d5..c64eee57 100644 --- a/apt/progress/old.py +++ b/apt/progress/old.py @@ -18,6 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA +# pylint: disable-msg = C0103 """Deprecated progress reporting classes. This module provides classes for compatibility with python-apt 0.7. They are @@ -195,10 +196,19 @@ class InstallProgress(DumbInstallProgress, base.InstallProgress): base.InstallProgress.update_interface) waitChild = function_deprecated_by(base.InstallProgress.wait_child) + def status_change(self, pkg, percent, status): + """(Abstract) Called when the APT status changed.""" + # compat with 0.7 + if apt_pkg._COMPAT_0_7 and hasattr(self, "statusChange"): + self.statusChange(pkg, percent, status) + class DpkgInstallProgress(InstallProgress): """Progress handler for a local Debian package installation.""" + debfile = "" + debname = "" + def run(self, debfile): """Start installing the given Debian package.""" # Deprecated stuff diff --git a/apt/utils.py b/apt/utils.py index dd52f824..80ba6d65 100644 --- a/apt/utils.py +++ b/apt/utils.py @@ -61,7 +61,7 @@ def get_release_filename_for_pkg(cache, pkgname, label, release): for aver in pkg._pkg.version_list: if aver is None or aver.file_list is None: continue - for ver_file, index in aver.file_list: + for ver_file, _index in aver.file_list: #print verFile if (ver_file.origin == label and ver_file.label == label and @@ -75,8 +75,8 @@ def get_release_filename_for_pkg(cache, pkgname, label, release): if (indexfile and indexfile.describe == m.describe and indexfile.is_trusted): - dir = apt_pkg.config.find_dir("Dir::State::lists") + dirname = apt_pkg.config.find_dir("Dir::State::lists") name = (apt_pkg.uri_to_filename(metaindex.uri) + "dists_%s_Release" % metaindex.dist) - return dir+name + return dirname + name return None -- cgit v1.2.3