summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <egon@bottom>2006-04-29 21:43:22 +0200
committerMichael Vogt <egon@bottom>2006-04-29 21:43:22 +0200
commitb2027f3494dcc42846c8a1106a4fd4b71cd8ed24 (patch)
treeef83cdce0261661c21f588edbe838acf47166d3c
parenta6d05b8fe1d75e27ca938e684971e4e0cb0ea8c9 (diff)
parent0e8fd33b1b741cc65c284a08faa50b3a2995ac3c (diff)
downloadpython-apt-b2027f3494dcc42846c8a1106a4fd4b71cd8ed24.tar.gz
* merged from mainline
-rw-r--r--apt/cache.py62
-rw-r--r--apt/package.py19
-rw-r--r--apt/progress.py20
-rw-r--r--debian/changelog32
-rw-r--r--debian/compat1
-rw-r--r--debian/control8
-rwxr-xr-xdebian/rules5
-rw-r--r--doc/examples/all_deps.py34
-rwxr-xr-xdoc/examples/build-deps.py2
-rw-r--r--doc/examples/indexfile.py1
-rw-r--r--doc/examples/progress.py17
-rw-r--r--doc/examples/sources.py6
-rw-r--r--python/indexfile.cc20
-rw-r--r--python/pkgrecords.cc2
-rw-r--r--python/pkgsrcrecords.cc31
-rw-r--r--python/tar.cc4
-rw-r--r--setup.py18
-rw-r--r--tests/pkgsrcrecords.py2
18 files changed, 206 insertions, 78 deletions
diff --git a/apt/cache.py b/apt/cache.py
index fbca0f2a..01034cf9 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -83,11 +83,7 @@ class Cache(object):
raise StopIteration
def has_key(self, key):
- try:
- self._dict[key]
- except KeyError:
- return False
- return True
+ return self._dict.has_key(key)
def __len__(self):
return len(self._dict)
@@ -116,8 +112,6 @@ class Cache(object):
def _runFetcher(self, fetcher):
# do the actual fetching
res = fetcher.Run()
- if res == fetcher.ResultFailed:
- return False
# now check the result (this is the code from apt-get.cc)
failed = False
@@ -146,31 +140,35 @@ class Cache(object):
if lock < 0:
raise IOError, "Failed to lock %s" % lockfile
- # this may as well throw a SystemError exception
- if not pm.GetArchives(fetcher, self._list, self._records):
- return False
- # now run the fetcher, throw exception if something fails to be
- # fetched
- res = self._runFetcher(fetcher)
-
- # cleanup
- os.close(lock)
- return res
+ try:
+ # this may as well throw a SystemError exception
+ if not pm.GetArchives(fetcher, self._list, self._records):
+ return False
+ # now run the fetcher, throw exception if something fails to be
+ # fetched
+ return self._runFetcher(fetcher)
+ finally:
+ os.close(lock)
def update(self, fetchProgress=None):
lockfile = apt_pkg.Config.FindDir("Dir::State::Lists") + "lock"
lock = apt_pkg.GetLock(lockfile)
if lock < 0:
raise IOError, "Failed to lock %s" % lockfile
- if fetchProgress == None:
- fetchProgress = apt.progress.FetchProgress()
- fetcher = apt_pkg.GetAcquire(fetchProgress)
- # this can throw a exception
- self._list.GetIndexes(fetcher)
- # now run the fetcher, throw exception if something fails to be
- # fetched
- res = self._runFetcher(fetcher)
- return res
+
+ try:
+ if fetchProgress == None:
+ fetchProgress = apt.progress.FetchProgress()
+ fetcher = apt_pkg.GetAcquire(fetchProgress)
+ # this can throw a exception
+ self._list.GetIndexes(fetcher)
+ # now run the fetcher, throw exception if something fails to be
+ # fetched
+ if self._runFetcher(fetcher) == fetcher.ResultContinue:
+ return True
+ return False
+ finally:
+ os.close(lock)
def installArchives(self, pm, installProgress):
installProgress.startUpdate()
@@ -266,11 +264,7 @@ class FilteredCache(object):
return self._filtered.keys()
def has_key(self, key):
- try:
- self._filtered[key]
- except KeyError:
- return False
- return True
+ return self._filtered.has_key(key)
def _reapplyFilter(self):
" internal helper to refilter "
@@ -337,9 +331,9 @@ if __name__ == "__main__":
# see if fetching works
- for dir in ["/tmp/pytest", "/tmp/pytest/partial"]:
- if not os.path.exists(dir):
- os.mkdir(dir)
+ 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")
pm = apt_pkg.GetPackageManager(c._depcache)
fetcher = apt_pkg.GetAcquire(apt.progress.TextFetchProgress())
diff --git a/apt/package.py b/apt/package.py
index 4633123a..4fceb904 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -19,19 +19,22 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
-import apt_pkg, string, sys, random
+import apt_pkg
+import sys
+import random
+import string
class Package(object):
""" This class represents a package in the cache
"""
- def __init__(self, cache, depcache, records, list, pcache, pkgiter):
+ def __init__(self, cache, depcache, records, sourcelist, pcache, pkgiter):
""" Init the Package object """
self._cache = cache # low level cache
self._depcache = depcache
self._records = records
self._pkg = pkgiter
- self._list = list # sourcelist
+ self._list = sourcelist # sourcelist
self._pcache = pcache # python cache in cache.py
pass
@@ -52,8 +55,8 @@ class Package(object):
if ver.FileList == None:
print "No FileList for: %s " % self._pkg.Name()
return False
- file, index = ver.FileList.pop(0)
- self._records.Lookup((file,index))
+ f, index = ver.FileList.pop(0)
+ self._records.Lookup((f,index))
return True
@@ -317,10 +320,10 @@ if __name__ == "__main__":
cache = apt_pkg.GetCache()
depcache = apt_pkg.GetDepCache(cache)
records = apt_pkg.GetPkgRecords(cache)
- list = apt_pkg.GetPkgSourceList()
+ sourcelist = apt_pkg.GetPkgSourceList()
- iter = cache["apt-utils"]
- pkg = Package(cache, depcache, records, list, None, iter)
+ pkgiter = cache["apt-utils"]
+ pkg = Package(cache, depcache, records, sourcelist, None, pkgiter)
print "Name: %s " % pkg.name
print "ID: %s " % pkg.id
print "Priority (Candidate): %s " % pkg.priority
diff --git a/apt/progress.py b/apt/progress.py
index 40cf8e48..4119067c 100644
--- a/apt/progress.py
+++ b/apt/progress.py
@@ -21,7 +21,7 @@
import sys, apt_pkg, os, fcntl, string, re
-class OpProgress:
+class OpProgress(object):
""" Abstract class to implement reporting on cache opening
Subclass this class to implement simple Operation progress reporting
"""
@@ -62,7 +62,7 @@ class FetchProgress(object):
dlIgnored : "Ignored"}
def __init__(self):
- self.eta = ""
+ self.eta = 0.0
self.percent = 0.0
pass
@@ -117,7 +117,7 @@ class TextFetchProgress(FetchProgress):
res = false;
return res
-class DumbInstallProgress:
+class DumbInstallProgress(object):
""" Report the install progress
Subclass this class to implement install progress reporting
"""
@@ -135,9 +135,10 @@ class DumbInstallProgress:
class InstallProgress(DumbInstallProgress):
""" A InstallProgress that is pretty useful.
It supports the attributes 'percent' 'status' and callbacks
- for the dpkg errors and conffiles (not implemented yet)
+ for the dpkg errors and conffiles and status changes
"""
def __init__(self):
+ DumbInstallProgress.__init__(self)
(read, write) = os.pipe()
self.writefd=write
self.statusfd = os.fdopen(read, "r")
@@ -151,6 +152,9 @@ class InstallProgress(DumbInstallProgress):
def conffile(self,current,new):
" called when a conffile question from dpkg is detected "
pass
+ def statusChange(self, pkg, percent, status):
+ " called when the status changed "
+ pass
def updateInterface(self):
if self.statusfd != None:
try:
@@ -173,8 +177,12 @@ class InstallProgress(DumbInstallProgress):
match = re.compile("\s*\'(.*)\'\s*\'(.*)\'.*").match(status_str)
if match:
self.conffile(match.group(1), match.group(2))
- self.percent = float(percent)
- self.status = string.strip(status_str)
+ elif status == "pmstatus":
+ if float(percent) != self.percent or \
+ status_str != self.status:
+ self.statusChange(pkg, float(percent), status_str.strip())
+ self.percent = float(percent)
+ self.status = string.strip(status_str)
self.read = ""
def fork(self):
diff --git a/debian/changelog b/debian/changelog
index 7b8925e0..e1dfd27a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,35 @@
+python-apt (0.6.17) unstable; urgency=low
+
+ * apt/progress.py:
+ - initialize FetchProgress.eta with the correct type
+ - strip the staus str before passing it to InstallProgress.statusChanged()
+ - added InstallProgress.statusChange(pkg, percent, status)
+ - make DumbInstallProgress a new-style class
+ (thanks to kamion for the suggestions)
+ - fix various pychecker warnings
+ * apt/cache.py:
+ - return useful values on Cache.update()
+ * apt/cache.py, apt/package.py: fix various pychecker warnings
+ * apt/cache.py: Release locks on failure (thanks to Colin Watson)
+ * python/srcrecords.cc:
+ - add "Restart" method
+ - don't run auto "Restart" before performing a Lookup
+ - fix the initalization (no need to pass a PkgCacheType to the records)
+ - added "Index" attribute
+ * python/indexfile.cc:
+ - added ArchiveURI() method
+
+ --
+
+python-apt (0.6.16.2) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * debian/control:
+ + Replaces: python-apt (<< 0.6.11), instead of Conflicts which is not
+ correct here. (closes: #308586).
+
+ -- Pierre Habouzit <madcoder@debian.org> Fri, 14 Apr 2006 19:30:51 +0200
+
python-apt (0.6.16.1) unstable; urgency=low
* memleak fixed when pkgCache objects are deallocated
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 00000000..7813681f
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+5 \ No newline at end of file
diff --git a/debian/control b/debian/control
index bfa67c67..6966077f 100644
--- a/debian/control
+++ b/debian/control
@@ -3,8 +3,8 @@ Section: python
Priority: optional
Maintainer: APT Development Team <deity@lists.debian.org>
Uploaders: Matt Zimmerman <mdz@debian.org>, Michael Vogt <mvo@debian.org>
-Standards-Version: 3.6.1.1
-Build-Depends: debhelper (>= 4.2.28), libapt-pkg-dev (>= 0.6.40), apt-utils, python-dev, python2.4-dev, python2.3-dev
+Standards-Version: 3.6.2.0
+Build-Depends: debhelper (>= 5.0), libapt-pkg-dev (>= 0.6.40), apt-utils, python-dev, python2.4-dev, python2.3-dev
Package: python-apt
Architecture: all
@@ -23,7 +23,7 @@ Description: Python interface to libapt-pkg
Package: python2.3-apt
Architecture: any
Depends: python2.3, ${shlibs:Depends}
-Conflicts: python-apt (<< 0.6.11)
+Replaces: python-apt (<< 0.6.11)
Priority: optional
Description: Python interface to libapt-pkg
The apt-pkg Python interface will provide full access to the internal
@@ -38,7 +38,7 @@ Description: Python interface to libapt-pkg
Package: python2.4-apt
Architecture: any
Depends: python2.4, ${shlibs:Depends}
-Conflicts: python-apt (<< 0.6.11)
+Replaces: python-apt (<< 0.6.11)
Priority: optional
Description: Python interface to libapt-pkg
The apt-pkg Python interface will provide full access to the internal
diff --git a/debian/rules b/debian/rules
index 0ab6fa27..584abdf5 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,9 +6,6 @@
# This has to be exported to make some magic below work.
export DH_OPTIONS
-# This is the debhelper compatibility version to use.
-export DH_COMPAT=3
-
DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p')
DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS)
@@ -83,7 +80,7 @@ source diff:
arch-build:
rm -rf debian/arch-build
mkdir -p debian/arch-build/python-apt-$(DEBVER)
- baz inventory -s | xargs cp -a --parents --target=debian/arch-build/python-apt-$(DEBVER)
+ tar -c --exclude=arch-build --no-recursion -f - `bzr inventory` | (cd debian/arch-build/python-apt-$(DEBVER);tar xf -)
(cd debian/arch-build/python-apt-$(DEBVER); $(DEB_BUILD_PROG))
binary: binary-indep binary-arch
diff --git a/doc/examples/all_deps.py b/doc/examples/all_deps.py
new file mode 100644
index 00000000..f4f1741c
--- /dev/null
+++ b/doc/examples/all_deps.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+
+import sys
+import apt
+
+
+def dependencies(cache, pkg, deps, key="Depends"):
+ #print "pkg: %s (%s)" % (pkg.name, deps)
+ candver = cache._depcache.GetCandidateVer(pkg._pkg)
+ if candver == None:
+ return deps
+ dependslist = candver.DependsList
+ if dependslist.has_key(key):
+ for depVerList in dependslist[key]:
+ for dep in depVerList:
+ if cache.has_key(dep.TargetPkg.Name):
+ if pkg.name != dep.TargetPkg.Name and not dep.TargetPkg.Name in deps:
+ deps.add(dep.TargetPkg.Name)
+ dependencies(cache, cache[dep.TargetPkg.Name], deps, key)
+ return deps
+
+
+pkgname = sys.argv[1]
+c = apt.Cache()
+pkg = c[pkgname]
+
+deps = set()
+
+deps = dependencies(c,pkg, deps, "Depends")
+print " ".join(deps)
+
+preDeps = set()
+preDeps = dependencies(c,pkg, preDeps, "PreDepends")
+print " ".join(preDeps)
diff --git a/doc/examples/build-deps.py b/doc/examples/build-deps.py
index b580f5de..65e35f3d 100755
--- a/doc/examples/build-deps.py
+++ b/doc/examples/build-deps.py
@@ -24,7 +24,7 @@ cache = apt_pkg.GetCache()
depcache = apt_pkg.GetDepCache(cache)
depcache.Init()
records = apt_pkg.GetPkgRecords(cache)
-srcrecords = apt_pkg.GetPkgSrcRecords(cache)
+srcrecords = apt_pkg.GetPkgSrcRecords()
# base package that we use for build-depends calculation
if len(sys.argv) < 2:
diff --git a/doc/examples/indexfile.py b/doc/examples/indexfile.py
index 5eaab517..d383fd61 100644
--- a/doc/examples/indexfile.py
+++ b/doc/examples/indexfile.py
@@ -18,3 +18,4 @@ for (f,i) in cand.FileList:
print index.IsTrusted
print index.Exists
print index.HasPackages
+ print index.ArchiveURI("some/path")
diff --git a/doc/examples/progress.py b/doc/examples/progress.py
index d820fcb2..2723c382 100644
--- a/doc/examples/progress.py
+++ b/doc/examples/progress.py
@@ -44,12 +44,16 @@ class TextFetchProgress(apt.FetchProgress):
class TextInstallProgress(apt.InstallProgress):
def __init__(self):
+ apt.InstallProgress.__init__(self)
pass
def startUpdate(self):
print "StartUpdate"
def finishUpdate(self):
print "FinishUpdate"
+ def statusChange(self, pkg, percent, status):
+ print "[%s] %s: %s" % (percent, pkg, status)
def updateInterface(self):
+ apt.InstallProgress.updateInterface(self)
# usefull to e.g. redraw a GUI
time.sleep(0.1)
@@ -70,3 +74,16 @@ class TextCdromProgress(apt.CdromProgress):
print "Please insert cdrom and press <ENTER>"
answer = sys.stdin.readline()
return True
+
+
+if __name__ == "__main__":
+ c = apt.Cache()
+ pkg = c["3dchess"]
+ if pkg.isInstalled:
+ pkg.markDelete()
+ else:
+ pkg.markInstall()
+
+ res = c.commit(TextFetchProgress(), TextInstallProgress())
+
+ print res
diff --git a/doc/examples/sources.py b/doc/examples/sources.py
index 79514621..78913523 100644
--- a/doc/examples/sources.py
+++ b/doc/examples/sources.py
@@ -4,6 +4,12 @@ import apt_pkg
apt_pkg.init()
+#cache = apt_pkg.GetCache()
+#sources = apt_pkg.GetPkgSrcRecords(cache)
+
sources = apt_pkg.GetPkgSrcRecords()
+sources.Restart()
while sources.Lookup('hello'):
print sources.Package, sources.Version, sources.Maintainer, sources.Section, `sources.Binaries`
+ #print sources.Files
+ print sources.Index.ArchiveURI("")
diff --git a/python/indexfile.cc b/python/indexfile.cc
index 4e106e25..ef6ffc8a 100644
--- a/python/indexfile.cc
+++ b/python/indexfile.cc
@@ -15,6 +15,22 @@
#include <Python.h>
+static PyObject *PackageIndexFileArchiveURI(PyObject *Self,PyObject *Args)
+{
+ pkgIndexFile *File = GetCpp<pkgIndexFile*>(Self);
+ char *path;
+
+ if (PyArg_ParseTuple(Args, "s",&path) == 0)
+ return 0;
+
+ return HandleErrors(Safe_FromString(File->ArchiveURI(path).c_str()));
+}
+
+static PyMethodDef PackageIndexFileMethods[] =
+{
+ {"ArchiveURI",PackageIndexFileArchiveURI,METH_VARARGS,"Returns the ArchiveURI"},
+ {}
+};
static PyObject *PackageIndexFileAttr(PyObject *Self,char *Name)
@@ -33,8 +49,7 @@ static PyObject *PackageIndexFileAttr(PyObject *Self,char *Name)
else if (strcmp("IsTrusted",Name) == 0)
return Py_BuildValue("i",(File->IsTrusted()));
- PyErr_SetString(PyExc_AttributeError,Name);
- return 0;
+ return Py_FindMethod(PackageIndexFileMethods,Self,Name);
}
static PyObject *PackageIndexFileRepr(PyObject *Self)
@@ -51,6 +66,7 @@ static PyObject *PackageIndexFileRepr(PyObject *Self)
File->IsTrusted(), File->ArchiveURI("").c_str());
return PyString_FromString(S);
}
+
PyTypeObject PackageIndexFileType =
{
PyObject_HEAD_INIT(&PyType_Type)
diff --git a/python/pkgrecords.cc b/python/pkgrecords.cc
index c6f5aeb9..ec78f554 100644
--- a/python/pkgrecords.cc
+++ b/python/pkgrecords.cc
@@ -46,7 +46,7 @@ static PyObject *PkgRecordsLookup(PyObject *Self,PyObject *Args)
// always return true (to make it consistent with the pkgsrcrecords object
return Py_BuildValue("i", 1);
}
-
+
static PyMethodDef PkgRecordsMethods[] =
{
{"Lookup",PkgRecordsLookup,METH_VARARGS,"Changes to a new package"},
diff --git a/python/pkgsrcrecords.cc b/python/pkgsrcrecords.cc
index 252810c7..5e04f5fc 100644
--- a/python/pkgsrcrecords.cc
+++ b/python/pkgsrcrecords.cc
@@ -43,7 +43,6 @@ static PyObject *PkgSrcRecordsLookup(PyObject *Self,PyObject *Args)
if (PyArg_ParseTuple(Args,"s",&Name) == 0)
return 0;
- Struct.Records->Restart();
Struct.Last = Struct.Records->Find(Name, false);
if (Struct.Last == 0) {
Struct.Records->Restart();
@@ -54,9 +53,25 @@ static PyObject *PkgSrcRecordsLookup(PyObject *Self,PyObject *Args)
return Py_BuildValue("i", 1);
}
+static char *doc_PkgSrcRecordsRestart = "Start Lookup from the begining";
+static PyObject *PkgSrcRecordsRestart(PyObject *Self,PyObject *Args)
+{
+ PkgSrcRecordsStruct &Struct = GetCpp<PkgSrcRecordsStruct>(Self);
+
+ char *Name = 0;
+ if (PyArg_ParseTuple(Args,"") == 0)
+ return 0;
+
+ Struct.Records->Restart();
+
+ Py_INCREF(Py_None);
+ return HandleErrors(Py_None);
+}
+
static PyMethodDef PkgSrcRecordsMethods[] =
{
{"Lookup",PkgSrcRecordsLookup,METH_VARARGS,doc_PkgSrcRecordsLookup},
+ {"Restart",PkgSrcRecordsRestart,METH_VARARGS,doc_PkgSrcRecordsRestart},
{}
};
@@ -81,8 +96,10 @@ static PyObject *PkgSrcRecordsAttr(PyObject *Self,char *Name)
*b != 0;
++b)
PyList_Append(List, CppPyString(*b));
-
return List; // todo
+ } else if (strcmp("Index",Name) == 0) {
+ const pkgIndexFile &tmp = Struct.Last->Index();
+ return CppOwnedPyObject_NEW<pkgIndexFile*>(Self,&PackageIndexFileType, (pkgIndexFile*)&tmp);
} else if (strcmp("Files",Name) == 0) {
PyObject *List = PyList_New(0);
@@ -126,10 +143,10 @@ PyTypeObject PkgSrcRecordsType =
PyObject_HEAD_INIT(&PyType_Type)
0, // ob_size
"pkgSrcRecords", // tp_name
- sizeof(CppOwnedPyObject<PkgSrcRecordsStruct>), // tp_basicsize
+ sizeof(CppPyObject<PkgSrcRecordsStruct>), // tp_basicsize
0, // tp_itemsize
// Methods
- CppOwnedDealloc<PkgSrcRecordsStruct>, // tp_dealloc
+ CppDealloc<PkgSrcRecordsStruct>, // tp_dealloc
0, // tp_print
PkgSrcRecordsAttr, // tp_getattr
0, // tp_setattr
@@ -145,11 +162,17 @@ PyTypeObject PkgSrcRecordsType =
PyObject *GetPkgSrcRecords(PyObject *Self,PyObject *Args)
{
+#if 0
PyObject *Owner;
if (PyArg_ParseTuple(Args,"O!",&PkgCacheType,&Owner) == 0)
return 0;
return HandleErrors(CppOwnedPyObject_NEW<PkgSrcRecordsStruct>(Owner,
&PkgSrcRecordsType));
+#endif
+ if (PyArg_ParseTuple(Args,"") == 0)
+ return 0;
+
+ return HandleErrors(CppPyObject_NEW<PkgSrcRecordsStruct>(&PkgSrcRecordsType));
}
diff --git a/python/tar.cc b/python/tar.cc
index 20fb1f5f..22c0327e 100644
--- a/python/tar.cc
+++ b/python/tar.cc
@@ -88,7 +88,7 @@ bool ProcessTar::DoItem(Item &Itm,int &Fd)
// ---------------------------------------------------------------------
/* */
char *doc_tarExtract =
-"tarExtract(File,Func,Comp) -> None"
+"tarExtract(File,Func,Comp) -> None\n"
"The tar file referenced by the file object File, Func called for each\n"
"Tar member. Comp must be the string \"gzip\" (gzip is automatically invoked) \n";
PyObject *tarExtract(PyObject *Self,PyObject *Args)
@@ -128,7 +128,7 @@ PyObject *tarExtract(PyObject *Self,PyObject *Args)
// ---------------------------------------------------------------------
/* */
char *doc_debExtract =
-"debExtract(File,Func,Chunk) -> None"
+"debExtract(File,Func,Chunk) -> None\n"
"The deb referenced by the file object File is examined. The AR member\n"
"given by Chunk is treated as a tar.gz and fed through Func like\n"
"tarExtract\n";
diff --git a/setup.py b/setup.py
index f9255607..5adb0376 100644
--- a/setup.py
+++ b/setup.py
@@ -7,22 +7,18 @@ import string, glob
# The apt_pkg module
-files = string.split(parse_makefile("python/makefile")["APT_PKG_SRC"]);
-for i in range(0,len(files)):
- files[i] = "python/"+ files[i];
-apt_pkg = Extension("apt_pkg", files,
- libraries=["apt-pkg"]);
+files = map(lambda source: "python/"+source,
+ string.split(parse_makefile("python/makefile")["APT_PKG_SRC"]))
+apt_pkg = Extension("apt_pkg", files, libraries=["apt-pkg"]);
# The apt_inst module
-files = string.split(parse_makefile("python/makefile")["APT_INST_SRC"]);
-for i in range(0,len(files)):
- files[i] = "python/"+ files[i];
-apt_inst = Extension("apt_inst", files,
- libraries=["apt-pkg","apt-inst"]);
+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"]);
setup(name="python-apt",
- version="0.6.13",
+ version="0.6.17",
description="Python bindings for APT",
author="APT Development Team",
author_email="deity@lists.debian.org",
diff --git a/tests/pkgsrcrecords.py b/tests/pkgsrcrecords.py
index dc4881dd..28df3f7c 100644
--- a/tests/pkgsrcrecords.py
+++ b/tests/pkgsrcrecords.py
@@ -14,7 +14,7 @@ def main():
print "Running PkgSrcRecords test on all packages:"
for x in cache.Packages:
i += 1
- src = apt_pkg.GetPkgSrcRecords(cache)
+ src = apt_pkg.GetPkgSrcRecords()
if src.Lookup(x.Name):
#print src.Package
pass