summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-11-10 16:06:21 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2011-11-10 16:06:21 +0100
commita0c9ec82095d2e09715e5dc953119ec4fa7b4c2e (patch)
tree4c1458a5304b24b6914610104cd0767168e658d8
parent52097d7edaa97379a4a604be4feb24e5e9c3bd73 (diff)
parent1948d5d03887eb81ea7797c0f23049ef6c3895ce (diff)
downloadpython-apt-a0c9ec82095d2e09715e5dc953119ec4fa7b4c2e.tar.gz
merge from the mvo branch
-rw-r--r--apt/cache.py2
-rw-r--r--apt/package.py3
-rw-r--r--debian/changelog10
-rw-r--r--debian/control2
-rw-r--r--po/python-apt.pot20
-rw-r--r--python/apt_pkgmodule.cc28
-rw-r--r--tests/test_apt_cache.py16
7 files changed, 69 insertions, 12 deletions
diff --git a/apt/cache.py b/apt/cache.py
index bab5c277..a4585277 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -111,7 +111,7 @@ class Cache(object):
]
for d in dirs:
if not os.path.exists(rootdir + d):
- print "creating: ", rootdir + d
+ #print "creating: ", rootdir + d
os.makedirs(rootdir + d)
for f in files:
if not os.path.exists(rootdir + f):
diff --git a/apt/package.py b/apt/package.py
index 4104f93e..cb373c2e 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -707,6 +707,9 @@ class Package(object):
return '<Package: name:%r architecture=%r id:%r>' % (self._pkg.name,
self._pkg.architecture, self._pkg.id)
+ def __cmp__(self, other):
+ return cmp(self.name, other.name)
+
def candidate(self):
"""Return the candidate version of the package.
diff --git a/debian/changelog b/debian/changelog
index 84a01e27..0c116489 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,15 @@ python-apt (0.8.2) UNRELEASED; urgency=low
- updated, thanks to Joe Dalton (closes: #631309)
* po/sr.po:
- updated, thanks to Nikola Nenadic (closes: #638308)
+ * python/apt_pkgmodule.cc:
+ - add apt_pkg.get_architectures() call
+ * apt/cache.py:
+ - remove "print" when creating dirs in apt.Cache(rootdir=dir),
+ thanks to Martin Pitt
+ - add __cmp__ to apt.Package so that sort() sorts by name
+ on list of package objects
+ * debian/control:
+ - add recommends to xz-lzma to ensure we have the unlzma command
[ Tshepang Lekhonkhobe ]
* rm usage of camelcase in cache.py doc (closes: #626617)
@@ -51,6 +60,7 @@ python-apt (0.8.1) unstable; urgency=low
that needs universe enabled as well (plus add test)
* apt/progress/gtk2.py:
- update to the latest vte API for child-exited (LP: #865388)
+ * tests/test_apt_cache.py:
-- Michael Vogt <mvo@debian.org> Wed, 19 Oct 2011 16:39:13 +0200
diff --git a/debian/control b/debian/control
index 01e8884e..541e4c36 100644
--- a/debian/control
+++ b/debian/control
@@ -22,7 +22,7 @@ Vcs-Browser: http://bzr.debian.org/loggerhead/apt/python-apt/debian-sid/changes
Package: python-apt
Architecture: any
Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}, python-apt-common
-Recommends: lsb-release, iso-codes, python2.6
+Recommends: lsb-release, iso-codes, python2.6, xz-lzma
Breaks: packagekit-backend-apt (<= 0.4.8-0ubuntu4),
computer-janitor (<< 1.14.1-1+),
debdelta (<< 0.41+),
diff --git a/po/python-apt.pot b/po/python-apt.pot
index 70c68099..d19871d0 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-10-19 18:07+0200\n"
+"POT-Creation-Date: 2011-10-21 10:10+0200\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"
@@ -455,11 +455,11 @@ msgstr ""
msgid "Invalid unicode in description for '%s' (%s). Please report."
msgstr ""
-#: ../apt/package.py:1065 ../apt/package.py:1171
+#: ../apt/package.py:1068 ../apt/package.py:1174
msgid "The list of changes is not available"
msgstr ""
-#: ../apt/package.py:1177
+#: ../apt/package.py:1180
#, python-format
msgid ""
"The list of changes is not available yet.\n"
@@ -468,7 +468,7 @@ msgid ""
"until the changes become available or try again later."
msgstr ""
-#: ../apt/package.py:1184
+#: ../apt/package.py:1187
msgid ""
"Failed to download the list of changes. \n"
"Please check your Internet connection."
@@ -535,26 +535,26 @@ msgstr ""
msgid "Cannot install '%s'"
msgstr ""
-#: ../apt/debfile.py:508
+#: ../apt/debfile.py:510
msgid "Python-debian module not available"
msgstr ""
-#: ../apt/debfile.py:542
+#: ../apt/debfile.py:544
msgid ""
"Automatically decompressed:\n"
"\n"
msgstr ""
-#: ../apt/debfile.py:548
+#: ../apt/debfile.py:550
msgid "Automatically converted to printable ascii:\n"
msgstr ""
-#: ../apt/debfile.py:638
+#: ../apt/debfile.py:640
#, python-format
msgid "Install Build-Dependencies for source package '%s' that builds %s\n"
msgstr ""
-#: ../apt/debfile.py:648
+#: ../apt/debfile.py:650
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:149
+#: ../apt/cache.py:148
msgid "Building data structures"
msgstr ""
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc
index e8490b4e..8532b1e3 100644
--- a/python/apt_pkgmodule.cc
+++ b/python/apt_pkgmodule.cc
@@ -25,6 +25,7 @@
#include <apt-pkg/init.h>
#include <apt-pkg/pkgsystem.h>
#include <apt-pkg/orderlist.h>
+#include <apt-pkg/aptconfiguration.h>
#include <sys/stat.h>
#include <libintl.h>
@@ -393,6 +394,30 @@ static PyObject *sha256sum(PyObject *Self,PyObject *Args)
return 0;
}
/*}}}*/
+// get_architectures - return the list of architectures /*{{{*/
+// ---------------------------------------------------------------------
+static const char *doc_GetArchitectures =
+ "get_architectures() -> list\n\n"
+ "Return the list of supported architectures on this system. On a \n"
+ "multiarch system this can be more than one. The main architectures\n"
+ "is the first item in the list.";;
+static PyObject *GetArchitectures(PyObject *Self,PyObject *Args)
+{
+ PyObject *Obj;
+ if (PyArg_ParseTuple(Args,"",&Obj) == 0)
+ return 0;
+
+ PyObject *List = PyList_New(0);
+ vector<string> arches = APT::Configuration::getArchitectures();
+ vector<string>::const_iterator I;
+ for (I = arches.begin(); I != arches.end(); I++)
+ {
+ PyList_Append(List, CppPyString(*I));
+ }
+
+ return List;
+}
+ /*}}}*/
// init - 3 init functions /*{{{*/
// ---------------------------------------------------------------------
static char *doc_Init =
@@ -539,6 +564,9 @@ static PyMethodDef methods[] =
{"sha1sum",sha1sum,METH_VARARGS,doc_sha1sum},
{"sha256sum",sha256sum,METH_VARARGS,doc_sha256sum},
+ // multiarch
+ {"get_architectures", GetArchitectures, METH_VARARGS, doc_GetArchitectures},
+
// Strings
{"check_domain_list",StrCheckDomainList,METH_VARARGS,
"check_domain_list(host: str, domains: str) -> bool\n\n"
diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py
index db68ec63..0d80f617 100644
--- a/tests/test_apt_cache.py
+++ b/tests/test_apt_cache.py
@@ -181,5 +181,21 @@ class TestAptCache(unittest.TestCase):
apt_pkg.config.set("dir::etc::sourcelist", old_source_list)
apt_pkg.config.set("dir::etc::sourceparts", old_source_parts)
+ def test_package_cmp(self):
+ cache = apt.Cache()
+ l = []
+ l.append(cache["libc6"])
+ l.append(cache["xterm"])
+ l.append(cache["apt"])
+ l.sort()
+ self.assertEqual([p.name for p in l],
+ ["apt", "libc6", "xterm"])
+
+ def test_get_architectures(self):
+ main_arch = apt.apt_pkg.config.get("APT::Architecture")
+ arches = apt_pkg.get_architectures()
+ self.assertTrue(main_arch in arches)
+
+
if __name__ == "__main__":
unittest.main()