Package: python-apt Version: 0.7.7.1+nmu1 Tags: patch Severity: wishlist It would be great if users could specify DestDir and DestFilename in apt_pkg.GetPkgAcqFile(). This is supported by apt-pkg and could really reduce code fetching files, like doc/examples/acquire.py. The attached patch adds the new arguments destDir and destFilename to GetPkgAcqFile(), as these names have already been used for the variables. It also documents all arguments and adjusts doc/examples/acquire.py to use this new argument. -- System Information: Debian Release: lenny/sid APT prefers testing APT policy: (990, 'testing'), (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.26-1-amd64 (SMP w/2 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages python-apt depends on: ii apt [libapt-pkg-libc6.7-6-4.6 0.7.16 Advanced front-end for dpkg ii apt-utils [libapt-inst-libc6. 0.7.16 APT utility programs ii libc6 2.7-15 GNU C Library: Shared libraries ii libgcc1 1:4.3.2-1 GCC support library ii libstdc++6 4.3.2-1 The GNU Standard C++ Library v3 ii lsb-release 3.2-20 Linux Standard Base version report ii python 2.5.2-2 An interactive high-level object-o ii python-central 0.6.8 register and build utility for Pyt python-apt recommends no packages. Versions of packages python-apt suggests: pn python-apt-dbg <none> (no description available) -- no debconf information -- Julian Andres Klode - Free Software Developer Debian Developer - Contributing Member of SPI Ubuntu Member - Fellow of FSFE Website: http://jak-linux.org/ XMPP: juliank@jabber.org Debian: http://www.debian.org/ SPI: http://www.spi-inc.org/ Ubuntu: http://www.ubuntu.com/ FSFE: http://www.fsfe.org/
--- python-apt-0.7.7.1+nmu1/debian/changelog 2008-10-24 13:46:04.000000000 +0200
+++ python-apt-0.7.7.1+nmu1+jak1/debian/changelog 2008-11-03 18:35:53.000000000 +0100
@@ -1,3 +1,9 @@
+python-apt (0.7.7.1+nmu1+jak1) unstable; urgency=low
+
+ * python/acquire.cc (GetPkgAcqFile): Support DestDir and DestFilename.
+
+ -- Julian Andres Klode <jak@debian.org> Mon, 03 Nov 2008 18:34:35 +0100
+
python-apt (0.7.7.1+nmu1) unstable; urgency=medium
* Non-maintainer upload.
--- python-apt-0.7.7.1+nmu1/doc/examples/acquire.py 2008-07-25 20:52:16.000000000 +0200
+++ python-apt-0.7.7.1+nmu1+jak1/doc/examples/acquire.py 2008-11-03 18:57:25.000000000 +0100
@@ -5,24 +5,13 @@
import tempfile
def get_file(fetcher, uri, destFile):
- cwd = os.getcwd()
- # create a temp dir
- dir = tempfile.mkdtemp()
- os.chdir(dir)
# get the file
af = apt_pkg.GetPkgAcqFile(fetcher,
uri=uri,
- descr="sample descr")
+ descr="sample descr", destFile=destFile)
res = fetcher.Run()
if res != fetcher.ResultContinue:
- os.rmdir(dir)
- os.chdir(cwd)
return False
- filename = os.path.basename(uri)
- os.rename(dir+"/"+filename,destFile)
- # cleanup
- os.rmdir(dir)
- os.chdir(cwd)
return True
apt_pkg.init()
--- python-apt-0.7.7.1+nmu1/python/acquire.cc 2008-07-25 20:52:17.000000000 +0200
+++ python-apt-0.7.7.1+nmu1+jak1/python/acquire.cc 2008-11-03 18:44:54.000000000 +0100
@@ -242,6 +242,8 @@
0, // tp_hash
};
+char *doc_GetPkgAcqFile =
+"GetPkgAcqFile(pkgAquire, uri[, md5, size, descr, shortDescr, destDir, destFile]) -> PkgAcqFile\n";
PyObject *GetPkgAcqFile(PyObject *Self, PyObject *Args, PyObject * kwds)
{
PyObject *pyfetcher;
@@ -250,11 +252,11 @@
uri = md5 = descr = shortDescr = destDir = destFile = "";
char * kwlist[] = {"owner","uri", "md5", "size", "descr", "shortDescr",
- NULL};
+ "destDir", "destFile", NULL};
- if (PyArg_ParseTupleAndKeywords(Args, kwds, "O!s|siss", kwlist,
+ if (PyArg_ParseTupleAndKeywords(Args, kwds, "O!s|sissss", kwlist,
&PkgAcquireType, &pyfetcher, &uri, &md5,
- &size, &descr, &shortDescr) == 0)
+ &size, &descr, &shortDescr, &destDir, &destFile) == 0)
return 0;
pkgAcquire *fetcher = GetCpp<pkgAcquire*>(pyfetcher);
@@ -263,7 +265,9 @@
md5, // md5
size, // size
descr, // descr
- shortDescr); // short-desc
+ shortDescr,
+ destDir,
+ destFile); // short-desc
CppPyObject<pkgAcqFile*> *AcqFileObj = CppPyObject_NEW<pkgAcqFile*>(&PkgAcquireFileType);
AcqFileObj->Object = af;
--- python-apt-0.7.7.1+nmu1/python/apt_pkgmodule.cc 2008-07-25 20:52:17.000000000 +0200
+++ python-apt-0.7.7.1+nmu1+jak1/python/apt_pkgmodule.cc 2008-11-03 18:49:25.000000000 +0100
@@ -447,7 +447,7 @@
// Acquire
{"GetAcquire",GetAcquire,METH_VARARGS,"GetAcquire() -> Acquire"},
- {"GetPkgAcqFile",(PyCFunction)GetPkgAcqFile,METH_KEYWORDS|METH_VARARGS,"GetPkgAcquireFile() -> pkgAcquireFile"},
+ {"GetPkgAcqFile",(PyCFunction)GetPkgAcqFile,METH_KEYWORDS|METH_VARARGS, doc_GetPkgAcqFile},
// PkgManager
{"GetPackageManager",GetPkgManager,METH_VARARGS,"GetPackageManager(DepCache) -> PackageManager"},
--- python-apt-0.7.7.1+nmu1/python/apt_pkgmodule.h 2008-07-25 20:52:17.000000000 +0200
+++ python-apt-0.7.7.1+nmu1+jak1/python/apt_pkgmodule.h 2008-11-03 18:48:51.000000000 +0100
@@ -75,6 +75,7 @@
// acquire
extern PyTypeObject PkgAcquireType;
+extern char *doc_GetPkgAcqFile;
PyObject *GetAcquire(PyObject *Self,PyObject *Args);
PyObject *GetPkgAcqFile(PyObject *Self, PyObject *Args, PyObject *kwds);
Attachment:
signature.asc
Description: Digital signature