From 5441b32e4b56bfc79610bd32b4fe3c4c4b5671dc Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 30 Jul 2009 15:55:35 +0200 Subject: Use debhelper 7 instead of CDBS --- debian/changelog | 3 ++- debian/compat | 2 +- debian/control | 7 +++---- debian/python-apt-dbg.install | 1 + debian/python-apt.docs | 2 ++ debian/python-apt.install | 9 +++++--- debian/rules | 48 ++++++++++++------------------------------- 7 files changed, 28 insertions(+), 44 deletions(-) create mode 100644 debian/python-apt-dbg.install diff --git a/debian/changelog b/debian/changelog index 298c0ac6..2c27b23d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -python-apt (0.7.11.2) unstable; urgency=low +python-apt (0.7.12.0) unstable; urgency=low [ Julian Andres Klode ] * python/cache.cc: @@ -18,6 +18,7 @@ python-apt (0.7.11.2) unstable; urgency=low - Allow to set the candidate of a package (Closes: #523997) + Support assignments to the 'candidate' property of Package objects. + Initial patch by Sebastian Heinlein + * Use debhelper 7 instead of CDBS [ Stefano Zacchiroli ] * debian/python-apt.doc-base: register the documentation with the diff --git a/debian/compat b/debian/compat index 7ed6ff82..7f8f011e 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -5 +7 diff --git a/debian/control b/debian/control index 83b2e421..1d3a9dd3 100644 --- a/debian/control +++ b/debian/control @@ -6,11 +6,10 @@ Uploaders: Michael Vogt , Julian Andres Klode Standards-Version: 3.8.2 XS-Python-Version: all Build-Depends: apt-utils, - cdbs, - debhelper (>= 5.0.37.1), + debhelper (>= 7.3.5), libapt-pkg-dev (>= 0.7.22~), - python-all-dbg, - python-all-dev, + python-all-dbg (>= 2.5.4-1), + python-all-dev (>= 2.5.4-1), python-central (>= 0.5), python-debian, python-distutils-extra (>= 1.9.0), diff --git a/debian/python-apt-dbg.install b/debian/python-apt-dbg.install new file mode 100644 index 00000000..1bbba721 --- /dev/null +++ b/debian/python-apt-dbg.install @@ -0,0 +1 @@ +usr/lib/python*/*/*_d.so diff --git a/debian/python-apt.docs b/debian/python-apt.docs index 6ba083f5..177b5837 100644 --- a/debian/python-apt.docs +++ b/debian/python-apt.docs @@ -1,4 +1,6 @@ README +AUTHORS +TODO apt/README.apt data/templates/README.templates build/doc/html/ diff --git a/debian/python-apt.install b/debian/python-apt.install index 4910e8ed..ca86ed11 100644 --- a/debian/python-apt.install +++ b/debian/python-apt.install @@ -1,3 +1,6 @@ -debian/tmp/usr/lib/python* -debian/tmp/usr/share/locale -debian/tmp/usr/share/python-apt +usr/lib/python*/*/apt_pkg.so +usr/lib/python*/*/apt_inst.so +usr/lib/python*/*/*/ +usr/lib/python*/*/*.egg-info +usr/share/locale +usr/share/python-apt diff --git a/debian/rules b/debian/rules index 6d709ecd..6e2204cf 100755 --- a/debian/rules +++ b/debian/rules @@ -1,42 +1,20 @@ #!/usr/bin/make -f - -DEB_AUTO_CLEANUP_RCS := yes -DEB_PYTHON_SYSTEM=pycentral - export DH_PYCENTRAL=nomove +export DEBVER=$(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p') +export CFLAGS=-Wno-write-strings -DEB_PYTHON_PACKAGES_EXCLUDE=python-apt-dbg - -# Add here any variable or target overrides you need -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/class/python-distutils.mk - -PKG=python-apt -DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p') -DEB_COMPRESS_EXCLUDE:=.html .js _static/* _sources/* _sources/*/* .inv -DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS) -export DEBVER - -build/python-apt-dbg:: - set -e; \ - for i in $(cdbs_python_build_versions); do \ - python$$i-dbg ./setup.py build; \ - done - -install/python-apt-dbg:: - for i in $(cdbs_python_build_versions); do \ - python$$i-dbg ./setup.py install --root $(CURDIR)/debian/python-apt-dbg; \ - done - find debian/python-apt-dbg \ - ! -type d ! -name '*_d.so' | xargs rm -f - find debian/python-apt-dbg -depth -empty -exec rmdir {} \; - -binary-predeb/python-apt:: - ln -sf ../../../../javascript/jquery/jquery.js debian/python-apt/usr/share/doc/python-apt/html/_static/jquery.js +%: + dh --with python-central $@ -binary-predeb/python-apt-dbg:: +override_dh_installdocs: + dh_installdocs + ln -sf ../../../../javascript/jquery/jquery.js \ + debian/python-apt/usr/share/doc/python-apt/html/_static/jquery.js rm -rf debian/python-apt-dbg/usr/share/doc/python-apt-dbg ln -s python-apt debian/python-apt-dbg/usr/share/doc/python-apt-dbg -clean:: - rm -rf build/lib* build/temp* +override_dh_strip: + dh_strip --dbg-package=python-apt-dbg + +override_dh_compress: + dh_compress -X.js -X_static/* -X _sources/* -X_sources/*/* -X.inv -- cgit v1.2.3 From 0cb44e7c914bf98d92a85d83b0bdc15ebc73525d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 30 Jul 2009 17:44:49 +0200 Subject: apt/package.py: Make comparisons of Version object more robust. --- apt/package.py | 40 +++++++++++++++++++++++++++++++++++----- debian/changelog | 13 +++++++------ 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/apt/package.py b/apt/package.py index f5bdc47d..0b8d4bf8 100644 --- a/apt/package.py +++ b/apt/package.py @@ -189,17 +189,47 @@ class Version(object): self.package = package self._cand = cand + def _cmp(self, other): + try: + return apt_pkg.VersionCompare(self._cand.VerStr, other.version) + except AttributeError: + return apt_pkg.VersionCompare(self._cand.VerStr, other) + def __eq__(self, other): - return self._cand.ID == other._cand.ID + try: + return self._cmp(other) == 0 + except TypeError: + return NotImplemented + + def __ge__(self): + try: + return self._cmp(other) >= 0 + except TypeError: + return NotImplemented def __gt__(self, other): - return apt_pkg.VersionCompare(self.version, other.version) > 0 + try: + return self._cmp(other) > 0 + except TypeError: + return NotImplemented + + def __le__(self): + try: + return self._cmp(other) <= 0 + except TypeError: + return NotImplemented def __lt__(self, other): - return apt_pkg.VersionCompare(self.version, other.version) < 0 + try: + return self._cmp(other) < 0 + except TypeError: + return NotImplemented def __ne__(self, other): - return not self.__eq__(other) + try: + return self._cmp(other) != 0 + except TypeError: + return NotImplemented def __hash__(self): return self._cand.Hash @@ -488,7 +518,7 @@ class Package(object): def candidate(self): """Return the candidate version of the package. - + This property is writeable to allow you to set the candidate version of the package. Just assign a Version() object, and it will be set as the candidate version. diff --git a/debian/changelog b/debian/changelog index 2c27b23d..122ebe92 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,7 @@ python-apt (0.7.12.0) unstable; urgency=low - Allow to set the candidate of a package (Closes: #523997) + Support assignments to the 'candidate' property of Package objects. + Initial patch by Sebastian Heinlein + - Make comparisons of Version object more robust. * Use debhelper 7 instead of CDBS [ Stefano Zacchiroli ] @@ -26,7 +27,7 @@ python-apt (0.7.12.0) unstable; urgency=low [ Sebastian Heinlein ] * apt/progress.py: Extract the package name from the status message - (Closes: #532660) + (Closes: #532660) -- Julian Andres Klode Thu, 30 Jul 2009 14:08:30 +0200 @@ -35,7 +36,7 @@ python-apt (0.7.11.1) unstable; urgency=low [ Stephan Peijnik ] * apt/progress/__init__.py: - Exception handling fixes in InstallProgress class. - + [ Michael Vogt ] * python/tag.cc: - merge patch from John Wright that adds FindRaw method @@ -50,15 +51,15 @@ python-apt (0.7.11.0) unstable; urgency=low [ Stephan Peijnik ] * apt/progress/__init__.py: - - add update_status_full() that takes file_size/partial_size as + - add update_status_full() that takes file_size/partial_size as additional callback arguments - - add pulse_items() that takes a addtional "items" tuple that + - add pulse_items() that takes a addtional "items" tuple that gives the user full access to the individual items that are fetched * python/progress.cc: - low level code for update_status_full and pulse_items() - better threading support - + [ Michael Vogt ] * aptsources/distro.py: - fix indent error that causes incorrect sources.list additons @@ -70,7 +71,7 @@ python-apt (0.7.11.0) unstable; urgency=low required dirs/files automatically -- Michael Vogt Mon, 20 Jul 2009 15:35:27 +0200 - + python-apt (0.7.10.4) unstable; urgency=low [ Michael Vogt ] -- cgit v1.2.3 From e1fe8a0fdc56452f820c837a323729d93f57f581 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 30 Jul 2009 17:49:35 +0200 Subject: Return VersionList objects in Package.versions, which are sequences and also provide features of mappings. (partial API BREAK) --- apt/package.py | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- debian/changelog | 2 ++ 2 files changed, 85 insertions(+), 3 deletions(-) diff --git a/apt/package.py b/apt/package.py index 0b8d4bf8..73ca5da0 100644 --- a/apt/package.py +++ b/apt/package.py @@ -29,11 +29,16 @@ import subprocess import urllib2 import warnings +try: + from collections import Sequence +except ImportError: + Sequence = object + import apt_pkg import apt.progress __all__ = ('BaseDependency', 'Dependency', 'Origin', 'Package', 'Record', - 'Version') + 'Version', 'VersionList') def _(string): @@ -499,6 +504,81 @@ class Version(object): return os.path.abspath(dsc) +class VersionList(Sequence): + """Provide a mapping & sequence interface to all versions of a package. + + This class can be used like a dictionary, where version strings are the + keys. It can also be used as a sequence, where integers are the keys. + + You can also convert this to a dictionary or a list, using the usual way + of dict(version_list) or list(version_list). This is useful if you need + to access the version objects multiple times, because they do not have to + be recreated this way. + + Examples ('package.versions' being a version list): + '0.7.92' in package.versions # Check whether 0.7.92 is a valid version. + package.versions[0] # Return first version or raise IndexError + package.versions[0:2] # Return a new VersionList for objects 0-2 + package.versions['0.7.92'] # Return version 0.7.92 or raise KeyError + package.versions.keys() # All keys, as strings. + max(package.versions) + """ + + def __init__(self, package, slice=None): + self._package = package # apt.package.Package() + self._versions = package._pkg.VersionList # [apt_pkg.Version(), ...] + if slice: + self._versions = self._versions[slice] + + def __getitem__(self, item): + if isinstance(item, slice): + return self.__class__(self._package, item) + try: + # Sequence interface, item is an integer + return Version(self._package, self._versions[item]) + except TypeError: + # Dictionary interface item is a string. + for ver in self._versions: + if ver.ver_str == item: + return Version(self._package, ver) + raise KeyError("Version: %r not found." % (item)) + + def __repr__(self): + return '' % self.keys() + + def __iter__(self): + """Return an iterator over all value objects.""" + return (Version(self._package, ver) for ver in self._versions) + + def __contains__(self, item): + if isinstance(item, Version): # Sequence interface + item = item.version + # Dictionary interface. + for ver in self._versions: + if ver.ver_str == item: + return True + return False + + def __eq__(self, other): + return list(self) == list(other) + + def __len__(self): + return len(self._versions) + + # Mapping interface + + def keys(self): + """Return a list of all versions, as strings.""" + return [ver.VerStr for ver in self._versions] + + def get(self, key, default=None): + """Return the key or the default.""" + try: + return self[key] + except LookupError: + return default + + class Package(object): """Representation of a package in a cache. @@ -911,11 +991,11 @@ class Package(object): @property def versions(self): - """Return a list of versions. + """Return a VersionList() object for all available versions. :since: 0.7.9 """ - return [Version(self, ver) for ver in self._pkg.VersionList] + return VersionList(self) # depcache actions diff --git a/debian/changelog b/debian/changelog index 122ebe92..c4ba63fc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,8 @@ python-apt (0.7.12.0) unstable; urgency=low + Support assignments to the 'candidate' property of Package objects. + Initial patch by Sebastian Heinlein - Make comparisons of Version object more robust. + - Return VersionList objects in Package.versions, which are sequences + and also provide features of mappings. (partial API BREAK) * Use debhelper 7 instead of CDBS [ Stefano Zacchiroli ] -- cgit v1.2.3 From d5465906199b5c866db900b99b59c107cb46055d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 30 Jul 2009 17:53:34 +0200 Subject: debian/changelog: Close #523998 as well --- debian/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/changelog b/debian/changelog index c4ba63fc..c2d30cf9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -21,6 +21,7 @@ python-apt (0.7.12.0) unstable; urgency=low - Make comparisons of Version object more robust. - Return VersionList objects in Package.versions, which are sequences and also provide features of mappings. (partial API BREAK) + + Allows to get a specific version (Closes: #523998) * Use debhelper 7 instead of CDBS [ Stefano Zacchiroli ] -- cgit v1.2.3 From bb517c1da9e82d36b2c599f308d5451be68fadcb Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 30 Jul 2009 18:29:13 +0200 Subject: apt/progress/__init__.py: Fix InstallProgress.waitChild() - Do not break out of InstallProgress.waitChild()'s loop just because it is hitting EINTR, but only on child exit or on ECHILD. --- apt/progress/__init__.py | 5 +++-- debian/changelog | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py index b9288c2c..337bd161 100644 --- a/apt/progress/__init__.py +++ b/apt/progress/__init__.py @@ -112,7 +112,7 @@ class FetchProgress(object): This happens eg. when the downloads fails or is completed. """ - def update_status_full(self, uri, descr, short_descr, status, file_size, + def update_status_full(self, uri, descr, short_descr, status, file_size, partial_size): """Called when the status of an item changes. @@ -291,7 +291,6 @@ class InstallProgress(DumbInstallProgress): except select.error, (errno_, errstr): if errno_ != errno.EINTR: raise - break self.updateInterface() try: (pid, res) = os.waitpid(self.child_pid, os.WNOHANG) @@ -300,6 +299,8 @@ class InstallProgress(DumbInstallProgress): except OSError, (errno_, errstr): if errno_ != errno.EINTR: raise + if errno_ == errno.ECHILD: + break return res def run(self, pm): diff --git a/debian/changelog b/debian/changelog index c2d30cf9..49c74106 100644 --- a/debian/changelog +++ b/debian/changelog @@ -22,6 +22,9 @@ python-apt (0.7.12.0) unstable; urgency=low - Return VersionList objects in Package.versions, which are sequences and also provide features of mappings. (partial API BREAK) + Allows to get a specific version (Closes: #523998) + * apt/progress/__init__.py: + - Do not break out of InstallProgress.waitChild()'s loop just because it + is hitting EINTR, but only on child exit or on ECHILD. * Use debhelper 7 instead of CDBS [ Stefano Zacchiroli ] -- cgit v1.2.3 From 1d67c8142d295004c894473df5457b8ce9ed6197 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 30 Jul 2009 19:07:33 +0200 Subject: debian/control: Do not use versioned build-deps on python-all-{dev,dbg}. Debhelper should conflict against older versions, as it uses --install-layout. But we should'nt do debhelper's work here. --- debian/control | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index 1d3a9dd3..6d27549a 100644 --- a/debian/control +++ b/debian/control @@ -8,8 +8,8 @@ XS-Python-Version: all Build-Depends: apt-utils, debhelper (>= 7.3.5), libapt-pkg-dev (>= 0.7.22~), - python-all-dbg (>= 2.5.4-1), - python-all-dev (>= 2.5.4-1), + python-all-dbg, + python-all-dev, python-central (>= 0.5), python-debian, python-distutils-extra (>= 1.9.0), -- cgit v1.2.3 From 057b8847b0645f501c34662ba60313cb4792b992 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 31 Jul 2009 12:39:17 +0200 Subject: * apt/package.py: Add missing argument to Version.__le__() and Version.__ge__() --- apt/package.py | 4 ++-- debian/changelog | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apt/package.py b/apt/package.py index 73ca5da0..308bd223 100644 --- a/apt/package.py +++ b/apt/package.py @@ -206,7 +206,7 @@ class Version(object): except TypeError: return NotImplemented - def __ge__(self): + def __ge__(self, other): try: return self._cmp(other) >= 0 except TypeError: @@ -218,7 +218,7 @@ class Version(object): except TypeError: return NotImplemented - def __le__(self): + def __le__(self, other): try: return self._cmp(other) <= 0 except TypeError: diff --git a/debian/changelog b/debian/changelog index 49c74106..ca1227d0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +python-apt (0.7.12.1) UNRELEASED; urgency=low + + * apt/package.py: + - Add missing argument to Version.__le__() and Version.__ge__() + + -- Julian Andres Klode Fri, 31 Jul 2009 12:38:18 +0200 + python-apt (0.7.12.0) unstable; urgency=low [ Julian Andres Klode ] -- cgit v1.2.3 From cdb7e74be8bfa4bc16aa8d9231829095f8689033 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 2 Aug 2009 19:13:11 +0200 Subject: debian/control: Do not build-depend on python-gtk2 and python-vte on kfreebsd-*. --- debian/changelog | 2 ++ debian/control | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index ca1227d0..db1eef02 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ python-apt (0.7.12.1) UNRELEASED; urgency=low * apt/package.py: - Add missing argument to Version.__le__() and Version.__ge__() + * debian/control: + - Do not build-depend on python-gtk2 and python-vte on kfreebsd-*. -- Julian Andres Klode Fri, 31 Jul 2009 12:38:18 +0200 diff --git a/debian/control b/debian/control index 6d27549a..7cd6f81d 100644 --- a/debian/control +++ b/debian/control @@ -13,9 +13,9 @@ Build-Depends: apt-utils, python-central (>= 0.5), python-debian, python-distutils-extra (>= 1.9.0), - python-gtk2, + python-gtk2 [!kfreebsd-amd64 !kfreebsd-i386], python-sphinx (>= 0.5), - python-vte + python-vte [!kfreebsd-amd64 !kfreebsd-i386] Vcs-Bzr: http://bzr.debian.org/apt/python-apt/debian-sid Vcs-Browser: http://bzr.debian.org/loggerhead/apt/python-apt/debian-sid/changes -- cgit v1.2.3 From 5975f86e017004a2391cba7d5fda7c6a8b24e2a5 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 2 Aug 2009 20:14:54 +0200 Subject: * setup.py: Always build documentation, even if python-gtk2 is not installed. --- debian/changelog | 2 ++ setup.py | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index db1eef02..a7cf71a3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ python-apt (0.7.12.1) UNRELEASED; urgency=low - Add missing argument to Version.__le__() and Version.__ge__() * debian/control: - Do not build-depend on python-gtk2 and python-vte on kfreebsd-*. + * setup.py: + - Always build documentation, even if python-gtk2 is not installed. -- Julian Andres Klode Fri, 31 Jul 2009 12:38:18 +0200 diff --git a/setup.py b/setup.py index 2afd0708..9c9758c9 100755 --- a/setup.py +++ b/setup.py @@ -63,12 +63,6 @@ setup(name="python-apt", if len(sys.argv) > 1 and sys.argv[1] == "build": import sphinx - try: - import pygtk - except ImportError: - print >> sys.stderr, ('W: Not building documentation because python-' - 'gtk2 is not available at the moment.') - sys.exit(0) sphinx.main(["sphinx", "-b", "html", "-d", "build/doc/doctrees", os.path.abspath("doc/source"), "build/doc/html"]) sphinx.main(["sphinx", "-b", "text", "-d", "build/doc/doctrees", -- cgit v1.2.3 From c3b546fad60e0d0afa99bab32b1669592c457d4e Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 3 Aug 2009 12:35:03 +0200 Subject: * apt/debfile.py: Fix missing space in message (Closes: #539704) --- apt/debfile.py | 2 +- debian/changelog | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apt/debfile.py b/apt/debfile.py index 0406a250..0e455508 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -78,7 +78,7 @@ class DebPackage(object): member) break except SystemError: - return [_("List of files for '%s'could not be read" % + return [_("List of files for '%s' could not be read" % self.filename)] return files diff --git a/debian/changelog b/debian/changelog index a7cf71a3..9595128c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,7 @@ python-apt (0.7.12.1) UNRELEASED; urgency=low + * apt/debfile.py: + - Fix missing space in message (Closes: #539704) * apt/package.py: - Add missing argument to Version.__le__() and Version.__ge__() * debian/control: -- cgit v1.2.3 From b901e22c3b747dd463bc13be10826bf90934c223 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 3 Aug 2009 15:17:56 +0200 Subject: Release 0.7.12.1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 9595128c..6e952afa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -python-apt (0.7.12.1) UNRELEASED; urgency=low +python-apt (0.7.12.1) unstable; urgency=low * apt/debfile.py: - Fix missing space in message (Closes: #539704) @@ -9,7 +9,7 @@ python-apt (0.7.12.1) UNRELEASED; urgency=low * setup.py: - Always build documentation, even if python-gtk2 is not installed. - -- Julian Andres Klode Fri, 31 Jul 2009 12:38:18 +0200 + -- Julian Andres Klode Mon, 03 Aug 2009 15:17:43 +0200 python-apt (0.7.12.0) unstable; urgency=low -- cgit v1.2.3