From 71e419a088092a3f6c62836d7bd09f952133fb3f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 4 Apr 2011 09:56:18 +0200 Subject: * python/cache.cc: - Add Package.get_fullname() and Package.architecture --- debian/changelog | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 0aed50d9..18e4354b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,7 +12,11 @@ python-apt (0.7.100.3) UNRELEASED; urgency=low - add test for xz compression * update priority of python3-apt to match the archive - -- Michael Vogt Mon, 21 Mar 2011 15:46:50 +0100 + [ Julian Andres Klode ] + * python/cache.cc: + - Add Package.get_fullname() and Package.architecture + + -- Julian Andres Klode Mon, 04 Apr 2011 09:48:10 +0200 python-apt (0.7.100.2) unstable; urgency=low -- cgit v1.2.3 From 79cb66e2737c3bfd87a5960f175f6281b1565190 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 4 Apr 2011 10:38:40 +0200 Subject: * apt/cache.py, apt/package.py: - Add architecture property to apt.Package (LP: #703472) - Change apt.Package.name to use get_fullname(pretty=True) (LP: #740072) --- apt/cache.py | 8 +++++++- apt/package.py | 42 ++++++++++++++++++++++++++++++++++-------- debian/changelog | 3 +++ 3 files changed, 44 insertions(+), 9 deletions(-) (limited to 'debian') diff --git a/apt/cache.py b/apt/cache.py index 4b917236..40fe40a9 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -132,6 +132,9 @@ class Cache(object): self._sorted_set = None self._weakref.clear() + self._have_multi_arch = bool(apt_pkg.config.value_list("APT::" + + "Architectures")) + progress.op = _("Building data structures") i = last = 0 size = len(self._cache.packages) @@ -141,7 +144,10 @@ class Cache(object): last = i # drop stuff with no versions (cruft) if pkg.has_versions: - self._set.add(pkg.name) + self._set.add(pkg.get_fullname(pretty=True)) + assert self._cache[pkg.get_fullname(pretty=True)] is not None + if self._have_multi_arch: + self._set.add(pkg.get_fullname(pretty=False)) i += 1 diff --git a/apt/package.py b/apt/package.py index f16ac2a4..d7d5d167 100644 --- a/apt/package.py +++ b/apt/package.py @@ -374,9 +374,9 @@ class Version(object): def source_name(self): """Return the name of the source package.""" try: - return self._records.source_pkg or self.package.name + return self._records.source_pkg or self.package.shortname except IndexError: - return self.package.name + return self.package.shortname @property def source_version(self): @@ -549,7 +549,7 @@ class Version(object): dsc = None record = self._records - source_name = record.source_pkg or self.package.name + source_name = record.source_pkg or self.package.shortname source_version = record.source_ver or self._cand.ver_str source_lookup = src.lookup(source_name) @@ -674,7 +674,8 @@ class Package(object): self._changelog = "" # Cached changelog def __repr__(self): - return '' % (self._pkg.name, self._pkg.id) + return '' % (self._pkg.name, + self._pkg.architecture, self._pkg.id) def candidate(self): """Return the candidate version of the package. @@ -706,7 +707,30 @@ class Package(object): @property def name(self): - """Return the name of the package.""" + """Return the name of the package, possibly including architecture. + + If the package is not part of the system's preferred architecture, + return the same as :attr:`fullname`, otherwise return the same + as :attr:`shortname` + + .. versionchanged:: 0.7.100.3 + As part of multi-arch, this field now may include architecture + information. + """ + return self._pkg.get_fullname(True) + + @property + def fullname(self): + """Return the name of the package, including architecture. + + .. versionadded:: 0.7.100.3""" + return self._pkg.get_fullname(False) + + @property + def shortname(self): + """Return the name of the package, without architecture. + + .. versionadded:: 0.7.100.3""" return self._pkg.name @property @@ -757,13 +781,15 @@ class Package(object): """ return getattr(self.installed, 'dependencies', []) - @DeprecatedProperty def architecture(self): """Return the Architecture of the package. - .. deprecated:: 0.7.9 + .. versionchanged:: 0.7.100.3 + This is now the package's architecture in the multi-arch sense, + previously it was the architecture of the candidate version + and deprecated. """ - return getattr(self.candidate, "architecture", None) + return self._pkg.architecture @DeprecatedProperty def candidateDownloadable(self): #pylint: disable-msg=C0103 diff --git a/debian/changelog b/debian/changelog index 18e4354b..174ae14c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,9 @@ python-apt (0.7.100.3) UNRELEASED; urgency=low [ Julian Andres Klode ] * python/cache.cc: - Add Package.get_fullname() and Package.architecture + * apt/cache.py, apt/package.py: + - Add architecture property to apt.Package (LP: #703472) + - Change apt.Package.name to use get_fullname(pretty=True) (LP: #740072) -- Julian Andres Klode Mon, 04 Apr 2011 09:48:10 +0200 -- cgit v1.2.3 From c17e4cde5cab0f5290d4b77092dfadf115ba4b02 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 4 Apr 2011 10:39:26 +0200 Subject: * tests/test_debfile.py: - Disable multi-arch for the test, it fails when run via test_all.py --- debian/changelog | 2 ++ tests/test_debfile.py | 3 +++ 2 files changed, 5 insertions(+) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 174ae14c..fc078c19 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,8 @@ python-apt (0.7.100.3) UNRELEASED; urgency=low * apt/cache.py, apt/package.py: - Add architecture property to apt.Package (LP: #703472) - Change apt.Package.name to use get_fullname(pretty=True) (LP: #740072) + * tests/test_debfile.py: + - Disable multi-arch for the test, it fails when run via test_all.py -- Julian Andres Klode Mon, 04 Apr 2011 09:48:10 +0200 diff --git a/tests/test_debfile.py b/tests/test_debfile.py index 32e52ddb..eadfbbd8 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -47,6 +47,9 @@ class TestDebfilee(unittest.TestCase): def setUp(self): apt_pkg.init_config() apt_pkg.config.set("APT::Architecture","i386") + # FIXME: When run via test_all.py, the tests fail without this if it + # is set in the system. + apt_pkg.config.clear("APT::Architectures") apt_pkg.config.set("Dir::State::status", "./data/test_debs/var/lib/dpkg/status") apt_pkg.config.set("Dir::State::lists", -- cgit v1.2.3 From d89f51fee4d09f543aa015b00d62e49a86c10eb1 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 4 Apr 2011 10:40:25 +0200 Subject: * tests/test_apt_cache.py: - Package records 'Package' field now corresponds to shortname --- debian/changelog | 2 ++ tests/test_apt_cache.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index fc078c19..34f126b8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -20,6 +20,8 @@ python-apt (0.7.100.3) UNRELEASED; urgency=low - Change apt.Package.name to use get_fullname(pretty=True) (LP: #740072) * tests/test_debfile.py: - Disable multi-arch for the test, it fails when run via test_all.py + * tests/test_apt_cache.py: + - Package records 'Package' field now corresponds to shortname -- Julian Andres Klode Mon, 04 Apr 2011 09:48:10 +0200 diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py index cfb3ab99..cccfc9c8 100644 --- a/tests/test_apt_cache.py +++ b/tests/test_apt_cache.py @@ -47,10 +47,10 @@ class TestAptCache(unittest.TestCase): # particular, when using compressed indexes, it should not use # tons of seek operations r = pkg.candidate.record - self.assertEqual(r['Package'], pkg.name) + self.assertEqual(r['Package'], pkg.shortname) self.assert_('Version' in r) self.assert_(len(r['Description']) > 0) - self.assert_(str(r).startswith('Package: %s\n' % pkg.name)) + self.assert_(str(r).startswith('Package: %s\n' % pkg.shortname)) def test_get_provided_packages(self): cache = apt.Cache() -- cgit v1.2.3 From fcd8b493d488afa542ffba3bdde0dada9f488352 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 4 Apr 2011 10:56:15 +0200 Subject: Merge not-uploaded NMU diff by scott kitterman * Override override_dh_auto_install to install python3 extensions in the correct locations (Closes: #619528) - Drop .so files from python3-apt.install * Removed ${python:Breaks} - No longer used in dh_python2 --- debian/changelog | 6 ++++++ debian/control | 2 +- debian/python3-apt.install | 2 -- debian/rules | 9 +++++++++ 4 files changed, 16 insertions(+), 3 deletions(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 34f126b8..857a3a7e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -23,6 +23,12 @@ python-apt (0.7.100.3) UNRELEASED; urgency=low * tests/test_apt_cache.py: - Package records 'Package' field now corresponds to shortname + [ Scott Kitterman ] + * Override override_dh_auto_install to install python3 extensions in the + correct locations (Closes: #619528) + - Drop .so files from python3-apt.install + * Removed ${python:Breaks} - No longer used in dh_python2 + -- Julian Andres Klode Mon, 04 Apr 2011 09:48:10 +0200 python-apt (0.7.100.2) unstable; urgency=low diff --git a/debian/control b/debian/control index c434e35b..9985a685 100644 --- a/debian/control +++ b/debian/control @@ -23,7 +23,7 @@ Package: python-apt Architecture: any Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}, python-apt-common Recommends: lsb-release, iso-codes, python2.6 -Breaks: debdelta (<< 0.28~), packagekit-backend-apt (<= 0.4.8-0ubuntu4), ${python:Breaks} +Breaks: debdelta (<< 0.28~), packagekit-backend-apt (<= 0.4.8-0ubuntu4) Provides: ${python:Provides} Suggests: python-apt-dbg, python-gtk2, python-vte, python-apt-doc XB-Python-Version: ${python:Versions} diff --git a/debian/python3-apt.install b/debian/python3-apt.install index 352d102b..6335f751 100644 --- a/debian/python3-apt.install +++ b/debian/python3-apt.install @@ -1,4 +1,2 @@ -usr/lib/python3*/*/apt_pkg*.so -usr/lib/python3*/*/apt_inst*.so usr/lib/python3*/*/*/ usr/lib/python3*/*/*.egg-info diff --git a/debian/rules b/debian/rules index a38b4605..d020e901 100755 --- a/debian/rules +++ b/debian/rules @@ -11,6 +11,15 @@ export SHELL = env PATH=$(PATH) sh override_dh_auto_build: dh_auto_build +override_dh_auto_install: + for i in $(shell py3versions -r); do \ + $$i ./setup.py install --install-layout=deb --root $(CURDIR)/debian/python3-apt; \ + done + for i in $(shell py3versions -r); do \ + $$i-dbg ./setup.py install --install-layout=deb --root $(CURDIR)/debian/python3-apt-dbg; \ + done + dh_auto_install + override_dh_installdocs: set -e; if [ -z $(filter -a,$(DH_INTERNAL_OPTIONS)) ]; then \ python setup.py build_sphinx; \ -- cgit v1.2.3 From 80e04f26777a5c7bd32b40a48f46f8d9f1c8aeb1 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 4 Apr 2011 11:07:57 +0200 Subject: Fix mixed tab/spaces indentation in xz test --- debian/changelog | 1 + tests/test_debfile.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 857a3a7e..b6c1945f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -20,6 +20,7 @@ python-apt (0.7.100.3) UNRELEASED; urgency=low - Change apt.Package.name to use get_fullname(pretty=True) (LP: #740072) * tests/test_debfile.py: - Disable multi-arch for the test, it fails when run via test_all.py + - Fix mixed tab/spaces indentation in xz test * tests/test_apt_cache.py: - Package records 'Package' field now corresponds to shortname diff --git a/tests/test_debfile.py b/tests/test_debfile.py index eadfbbd8..5f6d1aa2 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -116,7 +116,7 @@ Description: testpackage for gdebi - contains usr/bin/binary for file reading self.assertEqual(content, needle) def test_xz_data(self): - deb = apt.debfile.DebPackage("./data/test_debs/data-tar-xz.deb") + deb = apt.debfile.DebPackage("./data/test_debs/data-tar-xz.deb") self.assertEqual(deb.filelist, ["./", "usr/", "usr/bin/"]) -- cgit v1.2.3