summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <egon@debian-devbox>2011-12-01 14:13:28 +0100
committerMichael Vogt <egon@debian-devbox>2011-12-01 14:13:28 +0100
commitf0b627313d8c84116c860723a21d38b686a946ca (patch)
tree051a34a91c17964845a8dc26d79532f33558d8ee
parentd76a13a50fda292fe011a86f2b761d5753dc1470 (diff)
parentd236f527f85b185144875e0e7ad9102c4c2dabd0 (diff)
downloadpython-apt-f0b627313d8c84116c860723a21d38b686a946ca.tar.gz
merged from lp:~mvo/apt/mvo
-rw-r--r--apt/debfile.py19
-rw-r--r--apt/package.py16
-rw-r--r--apt/progress/base.py4
-rw-r--r--data/templates/Ubuntu.info.in52
-rw-r--r--debian/changelog23
-rw-r--r--po/python-apt.pot48
-rw-r--r--tests/test_apt_cache.py4
-rw-r--r--tests/test_debfile.py5
-rw-r--r--tests/test_utils.py1
9 files changed, 102 insertions, 70 deletions
diff --git a/apt/debfile.py b/apt/debfile.py
index 277262d7..c91ce349 100644
--- a/apt/debfile.py
+++ b/apt/debfile.py
@@ -530,11 +530,20 @@ class DebPackage(object):
@staticmethod
def to_strish(in_data):
s = ""
- for c in in_data:
- if ord(c) < 10 or ord(c) > 127:
- s += " "
- else:
- s += c
+ # py2 compat, in_data is type string
+ if type(in_data) == str:
+ for c in in_data:
+ if ord(c) < 10 or ord(c) > 127:
+ s += " "
+ else:
+ s += c
+ # py3 compat, in_data is type bytes
+ else:
+ for b in in_data:
+ if b < 10 or b > 127:
+ s += " "
+ else:
+ s += chr(b)
return s
def _get_content(self, part, name, auto_decompress=True, auto_hex=True):
diff --git a/apt/package.py b/apt/package.py
index 45d6044b..81f33a8b 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -94,7 +94,7 @@ class BaseDependency(object):
preDepend = AttributeDeprecatedBy('pre_depend')
-class Dependency(object):
+class Dependency(list):
"""Represent an Or-group of dependencies.
Attributes defined here:
@@ -102,11 +102,12 @@ class Dependency(object):
"""
def __init__(self, alternatives):
- self.or_dependencies = alternatives
-
- def __repr__(self):
- return repr(self.or_dependencies)
+ super(Dependency, self).__init__()
+ self.extend(alternatives)
+ @property
+ def or_dependencies(self):
+ return self
class DeprecatedProperty(property):
"""A property which gives DeprecationWarning on access.
@@ -455,6 +456,11 @@ class Version(object):
return self.get_dependencies("Recommends")
@property
+ def suggests(self):
+ """Return the suggests of the package version."""
+ return self.get_dependencies("Suggests")
+
+ @property
def origins(self):
"""Return a list of origins for the package version."""
origins = []
diff --git a/apt/progress/base.py b/apt/progress/base.py
index 97375431..4943978c 100644
--- a/apt/progress/base.py
+++ b/apt/progress/base.py
@@ -27,6 +27,7 @@ import fcntl
import os
import re
import select
+import sys
import apt_pkg
@@ -196,7 +197,8 @@ class InstallProgress(object):
os._exit(os.spawnlp(os.P_WAIT, "dpkg", "dpkg", "--status-fd",
str(self.write_stream.fileno()), "-i",
obj))
- except Exception:
+ except Exception as e:
+ sys.stderr.write("%s\n" % e)
os._exit(apt_pkg.PackageManager.RESULT_FAILED)
self.child_pid = pid
diff --git a/data/templates/Ubuntu.info.in b/data/templates/Ubuntu.info.in
index 9e62c0fa..3a9562f4 100644
--- a/data/templates/Ubuntu.info.in
+++ b/data/templates/Ubuntu.info.in
@@ -13,10 +13,10 @@ MirrorsFile-i386: Ubuntu.mirrors
_Description: Ubuntu 12.04 'Precise Pangolin'
Component: main
_CompDescription: Officially supported
-_CompDescriptionLong: Canonical-supported Open Source software
+_CompDescriptionLong: Canonical-supported free and open-source software
Component: universe
_CompDescription: Community-maintained
-_CompDescriptionLong: Community-maintained Open Source software
+_CompDescriptionLong: Community-maintained free and open-source software
Component: restricted
_CompDescription: Non-free drivers
_CompDescriptionLong: Proprietary drivers for devices
@@ -131,10 +131,10 @@ MirrorsFile-i386: Ubuntu.mirrors
_Description: Ubuntu 11.10 'Oneiric Ocelot'
Component: main
_CompDescription: Officially supported
-_CompDescriptionLong: Canonical-supported Open Source software
+_CompDescriptionLong: Canonical-supported free and open-source software
Component: universe
_CompDescription: Community-maintained
-_CompDescriptionLong: Community-maintained Open Source software
+_CompDescriptionLong: Community-maintained free and open-source software
Component: restricted
_CompDescription: Non-free drivers
_CompDescriptionLong: Proprietary drivers for devices
@@ -250,10 +250,10 @@ MirrorsFile-i386: Ubuntu.mirrors
_Description: Ubuntu 11.04 'Natty Narwhal'
Component: main
_CompDescription: Officially supported
-_CompDescriptionLong: Canonical-supported Open Source software
+_CompDescriptionLong: Canonical-supported free and open-source software
Component: universe
_CompDescription: Community-maintained
-_CompDescriptionLong: Community-maintained Open Source software
+_CompDescriptionLong: Community-maintained free and open-source software
Component: restricted
_CompDescription: Non-free drivers
_CompDescriptionLong: Proprietary drivers for devices
@@ -368,10 +368,10 @@ MirrorsFile-i386: Ubuntu.mirrors
_Description: Ubuntu 10.10 'Maverick Meerkat'
Component: main
_CompDescription: Officially supported
-_CompDescriptionLong: Canonical-supported Open Source software
+_CompDescriptionLong: Canonical-supported free and open-source software
Component: universe
_CompDescription: Community-maintained
-_CompDescriptionLong: Community-maintained Open Source software
+_CompDescriptionLong: Community-maintained free and open-source software
Component: restricted
_CompDescription: Non-free drivers
_CompDescriptionLong: Proprietary drivers for devices
@@ -451,10 +451,10 @@ MirrorsFile-i386: Ubuntu.mirrors
_Description: Ubuntu 10.04 'Lucid Lynx'
Component: main
_CompDescription: Officially supported
-_CompDescriptionLong: Canonical-supported Open Source software
+_CompDescriptionLong: Canonical-supported free and open-source software
Component: universe
_CompDescription: Community-maintained
-_CompDescriptionLong: Community-maintained Open Source software
+_CompDescriptionLong: Community-maintained free and open-source software
Component: restricted
_CompDescription: Non-free drivers
_CompDescriptionLong: Proprietary drivers for devices
@@ -514,10 +514,10 @@ MirrorsFile-i386: Ubuntu.mirrors
_Description: Ubuntu 9.10 'Karmic Koala'
Component: main
_CompDescription: Officially supported
-_CompDescriptionLong: Canonical-supported Open Source software
+_CompDescriptionLong: Canonical-supported free and open-source software
Component: universe
_CompDescription: Community-maintained
-_CompDescriptionLong: Community-maintained Open Source software
+_CompDescriptionLong: Community-maintained free and open-source software
Component: restricted
_CompDescription: Non-free drivers
_CompDescriptionLong: Proprietary drivers for devices
@@ -577,10 +577,10 @@ MirrorsFile-i386: Ubuntu.mirrors
_Description: Ubuntu 9.04 'Jaunty Jackalope'
Component: main
_CompDescription: Officially supported
-_CompDescriptionLong: Canonical-supported Open Source software
+_CompDescriptionLong: Canonical-supported free and open-source software
Component: universe
_CompDescription: Community-maintained
-_CompDescriptionLong: Community-maintained Open Source software
+_CompDescriptionLong: Community-maintained free and open-source software
Component: restricted
_CompDescription: Non-free drivers
_CompDescriptionLong: Proprietary drivers for devices
@@ -639,10 +639,10 @@ MirrorsFile-i386: Ubuntu.mirrors
_Description: Ubuntu 8.10 'Intrepid Ibex'
Component: main
_CompDescription: Officially supported
-_CompDescriptionLong: Canonical-supported Open Source software
+_CompDescriptionLong: Canonical-supported free and open-source software
Component: universe
_CompDescription: Community-maintained
-_CompDescriptionLong: Community-maintained Open Source software
+_CompDescriptionLong: Community-maintained free and open-source software
Component: restricted
_CompDescription: Non-free drivers
_CompDescriptionLong: Proprietary drivers for devices
@@ -703,10 +703,10 @@ MirrorsFile-i386: Ubuntu.mirrors
_Description: Ubuntu 8.04 'Hardy Heron'
Component: main
_CompDescription: Officially supported
-_CompDescriptionLong: Canonical-supported Open Source software
+_CompDescriptionLong: Canonical-supported free and open-source software
Component: universe
_CompDescription: Community-maintained
-_CompDescriptionLong: Community-maintained Open Source software
+_CompDescriptionLong: Community-maintained free and open-source software
Component: restricted
_CompDescription: Non-free drivers
_CompDescriptionLong: Proprietary drivers for devices
@@ -768,10 +768,10 @@ MirrorsFile: Ubuntu.mirrors
_Description: Ubuntu 7.10 'Gutsy Gibbon'
Component: main
_CompDescription: Officially supported
-_CompDescriptionLong: Canonical-supported Open Source software
+_CompDescriptionLong: Canonical-supported free and open-source software
Component: universe
_CompDescription: Community-maintained
-_CompDescriptionLong: Community-maintained Open Source software
+_CompDescriptionLong: Community-maintained free and open-source software
Component: restricted
_CompDescription: Non-free drivers
_CompDescriptionLong: Proprietary drivers for devices
@@ -832,10 +832,10 @@ MirrorsFile: Ubuntu.mirrors
_Description: Ubuntu 7.04 'Feisty Fawn'
Component: main
_CompDescription: Officially supported
-_CompDescriptionLong: Canonical-supported Open Source software
+_CompDescriptionLong: Canonical-supported free and open-source software
Component: universe
_CompDescription: Community-maintained
-_CompDescriptionLong: Community-maintained Open Source software
+_CompDescriptionLong: Community-maintained free and open-source software
Component: restricted
_CompDescription: Non-free drivers
_CompDescriptionLong: Proprietary drivers for devices
@@ -893,10 +893,10 @@ MirrorsFile: Ubuntu.mirrors
_Description: Ubuntu 6.10 'Edgy Eft'
Component: main
_CompDescription: Officially supported
-_CompDescriptionLong: Canonical-supported Open Source software
+_CompDescriptionLong: Canonical-supported free and open-source software
Component: universe
_CompDescription: Community-maintained
-_CompDescriptionLong: Community-maintained Open Source software
+_CompDescriptionLong: Community-maintained free and open-source software
Component: restricted
_CompDescription: Non-free drivers
_CompDescriptionLong: Proprietary drivers for devices
@@ -954,10 +954,10 @@ MirrorsFile: Ubuntu.mirrors
_Description: Ubuntu 6.06 LTS 'Dapper Drake'
Component: main
_CompDescription: Officially supported
-_CompDescriptionLong: Canonical-supported Open Source software
+_CompDescriptionLong: Canonical-supported free and open-source software
Component: universe
_CompDescription: Community-maintained (universe)
-_CompDescriptionLong: Community-maintained Open Source software
+_CompDescriptionLong: Community-maintained free and open-source software
Component: restricted
_CompDescription: Non-free drivers
_CompDescriptionLong: Proprietary drivers for devices
diff --git a/debian/changelog b/debian/changelog
index fece12fb..4cde2d21 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,14 +26,31 @@ python-apt (0.8.2) UNRELEASED; urgency=low
- set Dir::bin::dpkg if a alternate rootdir is given
(LP: #885895)
* build fixes for the apt in experimental
- * apt/debfile.py: raise error when accessing require_changes and
- missing_deps without calling check() before, thanks to
- Tshepang Lekhonkhobe (closes: #624379)
+ * apt/debfile.py:
+ - raise error when accessing require_changes and
+ missing_deps without calling check() before, thanks to
+ Tshepang Lekhonkhobe (closes: #624379)
+ * apt/package.py:
+ - add new "suggests" property, thanks to Christop Groth
+ - allow Dependency object to be iteratable, this allows to write
+ code like:
+ for or_dep_group in pkg.candidate.dependencies:
+ for dep in or_dep_group:
+ do_something()
+ (thanks to Christop Groth)
+ * apt/progress/base.py:
+ - write exception text to stderr to avoid hidding exceptions
+ like "pre-configure failed" from libapt (thanks to Jean-Baptiste
+ Lallement)
[ Tshepang Lekhonkhobe ]
* rm usage of camelcase in cache.py doc (closes: #626617)
* grammar fix in the cache.py doc (closes: #626610)
+ [ Nikola Pavlović ]
+ * fixed a typo, changed "Open Source software" to
+ "free and open-source software" (LP: #500940)
+
-- Michael Vogt <mvo@debian.org> Wed, 19 Oct 2011 18:03:42 +0200
python-apt (0.8.1) unstable; urgency=low
diff --git a/po/python-apt.pot b/po/python-apt.pot
index 046f5779..8772e88b 100644
--- a/po/python-apt.pot
+++ b/po/python-apt.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-11-10 17:20+0100\n"
+"POT-Creation-Date: 2011-12-01 13:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -190,7 +190,7 @@ msgstr ""
#. CompDescriptionLong
#: ../data/templates/Ubuntu.info.in:957
-msgid "Canonical-supported Open Source software"
+msgid "Canonical-supported free and open-source software"
msgstr ""
#. CompDescription
@@ -200,7 +200,7 @@ msgstr ""
#. CompDescriptionLong
#: ../data/templates/Ubuntu.info.in:960
-msgid "Community-maintained Open Source software"
+msgid "Community-maintained free and open-source software"
msgstr ""
#. CompDescription
@@ -450,16 +450,16 @@ msgstr ""
msgid "Complete"
msgstr ""
-#: ../apt/package.py:358
+#: ../apt/package.py:359
#, python-format
msgid "Invalid unicode in description for '%s' (%s). Please report."
msgstr ""
-#: ../apt/package.py:1068 ../apt/package.py:1174
+#: ../apt/package.py:1074 ../apt/package.py:1180
msgid "The list of changes is not available"
msgstr ""
-#: ../apt/package.py:1180
+#: ../apt/package.py:1186
#, python-format
msgid ""
"The list of changes is not available yet.\n"
@@ -468,29 +468,29 @@ msgid ""
"until the changes become available or try again later."
msgstr ""
-#: ../apt/package.py:1187
+#: ../apt/package.py:1193
msgid ""
"Failed to download the list of changes. \n"
"Please check your Internet connection."
msgstr ""
-#: ../apt/debfile.py:82
+#: ../apt/debfile.py:84
#, python-format
msgid "List of files for '%s' could not be read"
msgstr ""
-#: ../apt/debfile.py:167
+#: ../apt/debfile.py:169
#, python-format
msgid "Dependency is not satisfiable: %s\n"
msgstr ""
-#: ../apt/debfile.py:188
+#: ../apt/debfile.py:190
#, python-format
msgid "Conflicts with the installed package '%s'"
msgstr ""
#. TRANSLATORS: the first '%s' is the package that breaks, the second the dependency that makes it break, the third the relation (e.g. >=) and the latest the version for the releation
-#: ../apt/debfile.py:327
+#: ../apt/debfile.py:329
#, python-format
msgid ""
"Breaks existing package '%(pkgname)s' dependency %(depname)s "
@@ -498,63 +498,63 @@ msgid ""
msgstr ""
#. TRANSLATORS: the first '%s' is the package that conflicts, the second the packagename that it conflicts with (so the name of the deb the user tries to install), the third is the relation (e.g. >=) and the last is the version for the relation
-#: ../apt/debfile.py:343
+#: ../apt/debfile.py:345
#, python-format
msgid ""
"Breaks existing package '%(pkgname)s' conflict: %(targetpkg)s (%(comptype)s "
"%(targetver)s)"
msgstr ""
-#: ../apt/debfile.py:353
+#: ../apt/debfile.py:355
#, python-format
msgid ""
"Breaks existing package '%(pkgname)s' that conflict: '%(targetpkg)s'. But "
"the '%(debfile)s' provides it via: '%(provides)s'"
msgstr ""
-#: ../apt/debfile.py:399
+#: ../apt/debfile.py:403
msgid "No Architecture field in the package"
msgstr ""
-#: ../apt/debfile.py:404
+#: ../apt/debfile.py:408
#, python-format
msgid "Wrong architecture '%s'"
msgstr ""
#. the deb is older than the installed
-#: ../apt/debfile.py:411
+#: ../apt/debfile.py:415
msgid "A later version is already installed"
msgstr ""
-#: ../apt/debfile.py:436
+#: ../apt/debfile.py:440
msgid "Failed to satisfy all dependencies (broken cache)"
msgstr ""
-#: ../apt/debfile.py:466
+#: ../apt/debfile.py:470
#, python-format
msgid "Cannot install '%s'"
msgstr ""
-#: ../apt/debfile.py:510
+#: ../apt/debfile.py:514
msgid "Python-debian module not available"
msgstr ""
-#: ../apt/debfile.py:544
+#: ../apt/debfile.py:557
msgid ""
"Automatically decompressed:\n"
"\n"
msgstr ""
-#: ../apt/debfile.py:550
+#: ../apt/debfile.py:563
msgid "Automatically converted to printable ascii:\n"
msgstr ""
-#: ../apt/debfile.py:640
+#: ../apt/debfile.py:653
#, python-format
msgid "Install Build-Dependencies for source package '%s' that builds %s\n"
msgstr ""
-#: ../apt/debfile.py:650
+#: ../apt/debfile.py:664
msgid "An essential package would be removed"
msgstr ""
@@ -605,6 +605,6 @@ msgstr ""
msgid "Please insert a Disc in the drive and press enter"
msgstr ""
-#: ../apt/cache.py:148
+#: ../apt/cache.py:158
msgid "Building data structures"
msgstr ""
diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py
index 74d94ed8..6ec04ed5 100644
--- a/tests/test_apt_cache.py
+++ b/tests/test_apt_cache.py
@@ -55,8 +55,8 @@ class TestAptCache(unittest.TestCase):
# that is possible and does not crash
for pkg in cache:
if pkg.candidate:
- for or_dep in pkg.candidate.dependencies:
- for dep in or_dep.or_dependencies:
+ for or_deps in pkg.candidate.dependencies:
+ for dep in or_deps:
self.assertTrue(dep.name)
self.assertTrue(isinstance(dep.relation, str))
self.assertTrue(dep.pre_depend in (True, False))
diff --git a/tests/test_debfile.py b/tests/test_debfile.py
index d7c38b3d..af04af26 100644
--- a/tests/test_debfile.py
+++ b/tests/test_debfile.py
@@ -132,13 +132,12 @@ Description: testpackage for gdebi - contains usr/bin/binary for file reading
self.assertTrue(raised)
def test_multiarch_deb(self):
- #print apt_pkg.get_architectures()
if apt_pkg.get_architectures() != ["amd64", "i386"]:
logging.warn("skipping test because running on a non-multiarch system")
return
deb = apt.debfile.DebPackage("./data/test_debs/multiarch-test1_i386.deb")
- #print deb.missing_deps()
-
+ res = deb.check()
+ # FIXME: do something sensible with the multiarch test
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 23511f32..26ee0bff 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -7,7 +7,6 @@
# notice and this notice are preserved.
import sys
-sys.path.insert(0, "..")
import apt_pkg
import apt.utils
import datetime