summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-08-01 09:29:25 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-08-01 09:29:25 +0200
commiteec06677e01d9ba9d7edd95feb0cd858e7b8b6bc (patch)
tree311d72500e3146002b9c5e2350a4886d3c2b4dc5 /python
parent73050c16039e2adc3cb09b522a0ef36de450737e (diff)
parentc8bd732d5cb8be16ae48f8a72a4ed8a266b4ce36 (diff)
downloadpython-apt-eec06677e01d9ba9d7edd95feb0cd858e7b8b6bc.tar.gz
* merged from the debian/sid bzr branch
* Breaks: debsecan (<< 0.4.15) [not only << 0.4.14] (Closes: #629512) * python/arfile.cc: - use APT::Configuration::getCompressionTypes() instead of duplicating the supported methods here * tests/test_debfile.py: - add test for raise on unknown data.tar.xxx * tests/test_aptsources_ports.py, tests/test_aptsources.py: - use tmpdir during the tests to fix test failure with apt from experimental * Upload to unstable * Increase Breaks for update-notifier to 0.99.3debian9 * utils/get_debian_mirrors.py: Adjust for new Alioth SCM urls * debian/control: Standards-Version 3.9.2 * Fix Lintian overrides * Fix spelling errors reported by Lintian (sep[a->e]rated, overrid[d]en) * po/urd.po: Remove, ur.po is the correct file * debian/source/format: Add, set it to "3.0 (native)" * Fix get_changelog in Python 3 (Closes: #626532) * apt/package.py: fix a few typos [formated->formatted] (Closes: #597054) * doc/source/tutorials/contributing.rst: minor improvements (Closes: #625225) - one typo [2to => 2to3], one broken link [pep8.py link] * Esperanto (Closes: #626430)
Diffstat (limited to 'python')
-rw-r--r--python/arfile.cc52
-rw-r--r--python/cdrom.cc2
-rw-r--r--python/pkgmanager.cc12
3 files changed, 39 insertions, 27 deletions
diff --git a/python/arfile.cc b/python/arfile.cc
index c3aa74d1..c31ea35e 100644
--- a/python/arfile.cc
+++ b/python/arfile.cc
@@ -25,6 +25,8 @@
#include <apt-pkg/arfile.h>
#include <apt-pkg/error.h>
#include <apt-pkg/sptr.h>
+#include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/configuration.h>
#include <utime.h>
#include <unistd.h>
@@ -477,8 +479,8 @@ PyTypeObject PyArArchive_Type = {
* Representation of a Debian package.
*
* This does not resemble debDebFile in apt-inst, but instead is a subclass
- * of ArFile which adds properties for the control.tar.{xz,lzma,bz2,gz} and
- * data.tar.{xz,lzma,bz2,gz} members which return TarFile objects. It also adds
+ * of ArFile which adds properties for the control.tar.$compression and
+ * data.tar.$compression members which return TarFile objects. It also adds
* a descriptor 'version' which returns the content of 'debian-binary'.
*
* We are using it this way as it seems more natural to represent this special
@@ -532,21 +534,28 @@ static PyObject *debfile_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return PyErr_Format(PyExc_SystemError, "No debian archive, missing %s",
"control.tar.gz");
- self->data = _gettar(self, self->Object->FindMember("data.tar.gz"),
- "gzip");
- if (!self->data)
- self->data = _gettar(self, self->Object->FindMember("data.tar.bz2"),
- "bzip2");
- if (!self->data)
- self->data = _gettar(self, self->Object->FindMember("data.tar.lzma"),
- "lzma");
- if (!self->data)
- self->data = _gettar(self, self->Object->FindMember("data.tar.xz"),
- "xz");
- if (!self->data)
- return PyErr_Format(PyExc_SystemError, "No debian archive, missing %s",
- "data.tar.gz or data.tar.bz2 or data.tar.lzma "
- "or data.tar.xz");
+ // try all compression types
+ std::vector<std::string> types = APT::Configuration::getCompressionTypes();
+ for (std::vector<std::string>::const_iterator t = types.begin();
+ t != types.end(); ++t)
+ {
+ string member = string("data.tar.").append(*t);
+ string comp = _config->Find(string("Acquire::CompressionTypes::").append(*t));
+ self->data = _gettar(self, self->Object->FindMember(member.c_str()),
+ comp.c_str());
+ if (self->data)
+ break;
+ }
+ // no data found, we need to
+ if (!self->data) {
+ string error;
+ for (std::vector<std::string>::const_iterator t = types.begin();
+ t != types.end(); ++t)
+ error.append(*t + ",");
+ return PyErr_Format(PyExc_SystemError,
+ "No debian archive, missing data.tar.{%s}",
+ error.c_str());
+ }
const ARArchive::Member *member = self->Object->FindMember("debian-binary");
@@ -590,7 +599,9 @@ static PyGetSetDef debfile_getset[] = {
{"control",(getter)debfile_get_control,0,
"The TarFile object associated with the control.tar.gz member."},
{"data",(getter)debfile_get_data,0,
- "The TarFile object associated with the data.tar.{gz,bz2,lzma,xz}) member."},
+ "The TarFile object associated with the data.tar.$compression member. "
+ "All apt compression methods are supported. "
+ },
{"debian_binary",(getter)debfile_get_debian_binary,0,
"The package version, as contained in debian-binary."},
{NULL}
@@ -604,8 +615,9 @@ static const char *debfile_doc =
"specifying a file descriptor (returned by e.g. os.open()).\n"
"The recommended way of using it is to pass in the path to the file.\n\n"
"It differs from ArArchive by providing the members 'control', 'data'\n"
- "and 'version' for accessing the control.tar.gz, data.tar.{gz,bz2,lzma,xz},\n"
- "and debian-binary members in the archive.";
+ "and 'version' for accessing the control.tar.gz, data.tar.$compression \n"
+ "(all apt compression methods are supported), and debian-binary members \n"
+ "in the archive.";
PyTypeObject PyDebFile_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
diff --git a/python/cdrom.cc b/python/cdrom.cc
index 7f89e9d3..6ac16d59 100644
--- a/python/cdrom.cc
+++ b/python/cdrom.cc
@@ -52,7 +52,7 @@ static PyObject *cdrom_add(PyObject *Self,PyObject *Args)
static char *cdrom_ident_doc =
"ident(progress: apt_pkg.CdromProgress) -> str\n\n"
"Try to identify the CD-ROM and if successful return the hexadecimal\n"
- "CDROM-ID (and a integer version suffix seperated by -) as a\n"
+ "CDROM-ID (and a integer version suffix separated by -) as a\n"
"string. Otherwise, return None or raise an error.\n\n"
"The ID is created by hashing all file and directory names on the\n"
"CD-ROM and appending the version.";
diff --git a/python/pkgmanager.cc b/python/pkgmanager.cc
index b7bed658..f51dbbbc 100644
--- a/python/pkgmanager.cc
+++ b/python/pkgmanager.cc
@@ -295,24 +295,24 @@ static PyMethodDef PkgManager2Methods[] =
{
{"install",PkgManagerInstall,METH_VARARGS,
"install(pkg: Package, filename: str) -> bool \n\n"
- "Add a install action. Can be overriden in subclasses.\n\n"
+ "Add a install action. Can be overridden in subclasses.\n\n"
"New in version 0.8.0."},
{"configure",PkgManagerConfigure,METH_VARARGS,
"configure(pkg: Package) -> bool \n\n"
- "Add a configure action. Can be overriden in subclasses.\n\n"
+ "Add a configure action. Can be overridden in subclasses.\n\n"
"New in version 0.8.0."},
{"remove",PkgManagerRemove,METH_VARARGS,
"remove(pkg: Package, purge: bool) -> bool \n\n"
- "Add a removal action. Can be overriden in subclasses.\n\n"
+ "Add a removal action. Can be overridden in subclasses.\n\n"
"New in version 0.8.0."},
{"go",PkgManagerGo,METH_VARARGS,
"go(status_fd: int) -> bool \n\n"
- "Start dpkg. Can be overriden in subclasses.\n\n"
+ "Start dpkg. Can be overridden in subclasses.\n\n"
"New in version 0.8.0."},
{"reset",PkgManagerReset,METH_VARARGS,
"reset()\n\n"
"Reset the package manager for a new round.\n"
- "Can be overriden in subclasses.\n\n"
+ "Can be overridden in subclasses.\n\n"
"New in version 0.8.0."},
{}
};
@@ -323,7 +323,7 @@ static const char *packagemanager2_doc =
"installation and the installation of those packages. The parameter\n"
"'depcache' specifies an apt_pkg.DepCache object where information\n"
"about the package selections is retrieved from.\n\n"
- "Methods in this class can be overriden in sub classes\n"
+ "Methods in this class can be overridden in sub classes\n"
"to implement behavior different from APT's dpkg implementation.";
PyTypeObject PyPackageManager2_Type =
{