From 55b2eeb0b63b544b3519b019f6d3969d88296618 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 28 Feb 2006 10:59:54 +0000 Subject: * interface fixes for kamion, pychecker fixes --- debian/changelog | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 7b8925e0..4a37a69d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +python-apt (0.6.16.2) unstable; urgency=low + + * apt/progress.py: + - 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, apt/package.py: fix various pychecker warnings + + + -- Michael Vogt Tue, 28 Feb 2006 11:40:38 +0100 + python-apt (0.6.16.1) unstable; urgency=low * memleak fixed when pkgCache objects are deallocated -- cgit v1.2.3 From d38698d25c5fdda005f02427357fa97a7d7e2a86 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 28 Feb 2006 11:00:13 +0000 Subject: * un-finalize the changelog --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 4a37a69d..77e5794b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,7 +8,7 @@ python-apt (0.6.16.2) unstable; urgency=low * apt/cache.py, apt/package.py: fix various pychecker warnings - -- Michael Vogt Tue, 28 Feb 2006 11:40:38 +0100 + -- python-apt (0.6.16.1) unstable; urgency=low -- cgit v1.2.3 From ef973e43572c5748f908ae0e353e71d61028b479 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 28 Feb 2006 11:51:52 +0000 Subject: * initalize FetchProgress.eta as float and pass a float to InstallProgress.statusChanged() for percent --- apt/progress.py | 4 ++-- debian/changelog | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'debian') diff --git a/apt/progress.py b/apt/progress.py index 9958b9b7..1b437a46 100644 --- a/apt/progress.py +++ b/apt/progress.py @@ -62,7 +62,7 @@ class FetchProgress(object): dlIgnored : "Ignored"} def __init__(self): - self.eta = "" + self.eta = 0.0 self.percent = 0.0 pass @@ -180,7 +180,7 @@ class InstallProgress(DumbInstallProgress): elif status == "pmstatus": if float(percent) != self.percent or \ status_str != self.status: - self.statusChange(pkg, percent, status_str) + self.statusChange(pkg, float(percent), status_str) self.percent = float(percent) self.status = string.strip(status_str) self.read = "" diff --git a/debian/changelog b/debian/changelog index 77e5794b..aef1f70c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -python-apt (0.6.16.2) unstable; urgency=low +python-apt (0.6.16.2ubuntu1) dapper; urgency=low * apt/progress.py: - added InstallProgress.statusChange(pkg, percent, status) @@ -8,7 +8,7 @@ python-apt (0.6.16.2) unstable; urgency=low * apt/cache.py, apt/package.py: fix various pychecker warnings - -- + -- Michael Vogt Tue, 28 Feb 2006 12:04:37 +0100 python-apt (0.6.16.1) unstable; urgency=low -- cgit v1.2.3 From 6192052ee2e16c88303772c466016af6aa781ed0 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 28 Feb 2006 11:58:42 +0000 Subject: * strip status string before passing it, changelog updates --- apt/progress.py | 2 +- debian/changelog | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'debian') diff --git a/apt/progress.py b/apt/progress.py index 1b437a46..4119067c 100644 --- a/apt/progress.py +++ b/apt/progress.py @@ -180,7 +180,7 @@ class InstallProgress(DumbInstallProgress): elif status == "pmstatus": if float(percent) != self.percent or \ status_str != self.status: - self.statusChange(pkg, float(percent), status_str) + self.statusChange(pkg, float(percent), status_str.strip()) self.percent = float(percent) self.status = string.strip(status_str) self.read = "" diff --git a/debian/changelog b/debian/changelog index aef1f70c..94283b9d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +python-apt (0.6.16.2ubuntu2) dapper; urgency=low + + * apt/progress.py: + - initialize FetchProgress.eta with the correct type + - strip the staus str before passing it to InstallProgress.statusChanged() + + -- + python-apt (0.6.16.2ubuntu1) dapper; urgency=low * apt/progress.py: -- cgit v1.2.3 From cc3414d9a1a42e1978834392a2bead330c19ec99 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 28 Feb 2006 13:11:50 +0000 Subject: * fix the return value of Cache.update() --- apt/cache.py | 6 +++--- debian/changelog | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'debian') diff --git a/apt/cache.py b/apt/cache.py index c98c0d49..459ffc40 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -148,7 +148,6 @@ class Cache(object): # now run the fetcher, throw exception if something fails to be # fetched res = self._runFetcher(fetcher) - # cleanup os.close(lock) return res @@ -165,8 +164,9 @@ class Cache(object): self._list.GetIndexes(fetcher) # now run the fetcher, throw exception if something fails to be # fetched - res = self._runFetcher(fetcher) - return res + if self._runFetcher(fetcher) == fetcher.ResultContinue: + return True + return False def installArchives(self, pm, installProgress): installProgress.startUpdate() diff --git a/debian/changelog b/debian/changelog index 94283b9d..cc7e7e56 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,10 @@ python-apt (0.6.16.2ubuntu2) dapper; urgency=low * apt/progress.py: - initialize FetchProgress.eta with the correct type - strip the staus str before passing it to InstallProgress.statusChanged() + * apt/cache.py: + - return useful values on Cache.update() - -- + -- Michael Vogt Tue, 28 Feb 2006 14:07:06 +0100 python-apt (0.6.16.2ubuntu1) dapper; urgency=low -- cgit v1.2.3 From cbcd7a454118a4633102969cdd3ff657b1b24655 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 28 Feb 2006 20:13:10 +0000 Subject: * updated changelog --- debian/changelog | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index cc7e7e56..23f586d9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,24 +1,18 @@ -python-apt (0.6.16.2ubuntu2) dapper; urgency=low +python-apt (0.6.16.2) unstable; urgency=low * apt/progress.py: - initialize FetchProgress.eta with the correct type - strip the staus str before passing it to InstallProgress.statusChanged() - * apt/cache.py: - - return useful values on Cache.update() - - -- Michael Vogt Tue, 28 Feb 2006 14:07:06 +0100 - -python-apt (0.6.16.2ubuntu1) dapper; urgency=low - - * apt/progress.py: - 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 - -- Michael Vogt Tue, 28 Feb 2006 12:04:37 +0100 + -- python-apt (0.6.16.1) unstable; urgency=low -- cgit v1.2.3 From 4e7cf23803ea29eb90b9c663cb6ded845067a6c7 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 21 Mar 2006 15:08:34 +0100 Subject: * fix lock-releasing on exception (thanks to kamion) --- apt/cache.py | 42 +++++++++++++++++++++++------------------- debian/changelog | 2 +- 2 files changed, 24 insertions(+), 20 deletions(-) (limited to 'debian') diff --git a/apt/cache.py b/apt/cache.py index 9218263b..01034cf9 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -140,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 - if self._runFetcher(fetcher) == fetcher.ResultContinue: - return True - return False + + 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() diff --git a/debian/changelog b/debian/changelog index 23f586d9..e621b8d6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,7 +10,7 @@ python-apt (0.6.16.2) unstable; urgency=low * 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) -- -- cgit v1.2.3 From e02913b6f336d4bf5bc2c17032c91ade974de04f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 22 Mar 2006 14:56:29 +0100 Subject: * fixes for the pkgSrcRecords code --- debian/changelog | 8 ++++++-- doc/examples/build-deps.py | 2 +- doc/examples/sources.py | 6 ++++++ python/pkgrecords.cc | 2 +- python/pkgsrcrecords.cc | 27 ++++++++++++++++++++++++--- tests/pkgsrcrecords.py | 2 +- 6 files changed, 39 insertions(+), 8 deletions(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index e621b8d6..4b677c2e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,8 +11,12 @@ python-apt (0.6.16.2) unstable; urgency=low - 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) + + -- Michael Vogt Wed, 22 Mar 2006 11:19:34 +0100 python-apt (0.6.16.1) unstable; urgency=low 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/sources.py b/doc/examples/sources.py index 79514621..0a90bae9 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 + 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..abb29c74 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(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}, {} }; @@ -126,10 +141,10 @@ PyTypeObject PkgSrcRecordsType = PyObject_HEAD_INIT(&PyType_Type) 0, // ob_size "pkgSrcRecords", // tp_name - sizeof(CppOwnedPyObject), // tp_basicsize + sizeof(CppPyObject), // tp_basicsize 0, // tp_itemsize // Methods - CppOwnedDealloc, // tp_dealloc + CppDealloc, // tp_dealloc 0, // tp_print PkgSrcRecordsAttr, // tp_getattr 0, // tp_setattr @@ -145,11 +160,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(Owner, &PkgSrcRecordsType)); +#endif + if (PyArg_ParseTuple(Args,"") == 0) + return 0; + + return HandleErrors(CppPyObject_NEW(&PkgSrcRecordsType)); } 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 -- cgit v1.2.3 From de94cc6cd97201a9cd3fc845b06b97e46251403d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 22 Mar 2006 15:25:48 +0100 Subject: * updated changelog --- debian/changelog | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 4b677c2e..976e078f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,8 +15,11 @@ python-apt (0.6.16.2) unstable; urgency=low - 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 - -- Michael Vogt Wed, 22 Mar 2006 11:19:34 +0100 + -- python-apt (0.6.16.1) unstable; urgency=low -- cgit v1.2.3 From 0e8fd33b1b741cc65c284a08faa50b3a2995ac3c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 26 Apr 2006 10:17:09 +0200 Subject: * debian/compat: - debhelper compat level set to 5 * debian/changelog: - merged the changelog from the NMU * debian/control: - merged the changes from the NMU - set standards version to 3.6.2.0 * debian/rules: - fix arch-build target * setup.py: - simplify the patch magling by using map() instead of "for i in range()" --- debian/changelog | 13 +++++++++++-- debian/compat | 1 + debian/control | 8 ++++---- debian/rules | 5 +---- setup.py | 18 +++++++----------- 5 files changed, 24 insertions(+), 21 deletions(-) create mode 100644 debian/compat (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 976e078f..e1dfd27a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -python-apt (0.6.16.2) unstable; urgency=low +python-apt (0.6.17) unstable; urgency=low * apt/progress.py: - initialize FetchProgress.eta with the correct type @@ -19,8 +19,17 @@ python-apt (0.6.16.2) unstable; urgency=low * 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 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 Uploaders: Matt Zimmerman , Michael Vogt -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/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", -- cgit v1.2.3