summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-12-07 10:40:14 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-12-07 10:40:14 +0000
commitcce2b71c2fd64c8587238178c27a049ec450ce07 (patch)
tree04e79ceab8ae37df0fea94b895ed7df7ec745bbf
parentb4141dda949890eaa50f0097b6fc6baeb3c489ac (diff)
downloadpython-apt-cce2b71c2fd64c8587238178c27a049ec450ce07.tar.gz
* make pkgAcqFile use the old interface so that we don't depend on a new apt and still work with breezys apt
-rw-r--r--debian/changelog2
-rw-r--r--debian/control2
-rw-r--r--doc/examples/acquire.py28
-rw-r--r--python/acquire.cc12
4 files changed, 29 insertions, 15 deletions
diff --git a/debian/changelog b/debian/changelog
index 2c202597..5f4c0856 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,7 @@
python-apt (0.6.16) unstable; urgency=low
* added GetPkgAcqFile to queue individual file downloads with the
- system
+ system (dosn't make use of the improved pkgAcqFile yet)
* added SourceList.GetIndexes()
* rewrote apt.cache.update() to use the improved aquire interface
* apt/ API change: apt.Package.candidateOrigin returns a list of origins
diff --git a/debian/control b/debian/control
index 472712d9..bfa67c67 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: optional
Maintainer: APT Development Team <deity@lists.debian.org>
Uploaders: Matt Zimmerman <mdz@debian.org>, Michael Vogt <mvo@debian.org>
Standards-Version: 3.6.1.1
-Build-Depends: debhelper (>= 4.2.28), libapt-pkg-dev (>= 0.6.43), apt-utils, python-dev, python2.4-dev, python2.3-dev
+Build-Depends: debhelper (>= 4.2.28), libapt-pkg-dev (>= 0.6.40), apt-utils, python-dev, python2.4-dev, python2.3-dev
Package: python-apt
Architecture: all
diff --git a/doc/examples/acquire.py b/doc/examples/acquire.py
index 516a3d6d..a0790c98 100644
--- a/doc/examples/acquire.py
+++ b/doc/examples/acquire.py
@@ -2,6 +2,28 @@ import apt
import apt_pkg
import os
import sys
+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")
+ 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()
@@ -45,11 +67,7 @@ pm = apt_pkg.GetPackageManager(depcache)
print pm
print fetcher
-af = apt_pkg.GetPkgAcqFile(fetcher,
- uri="ftp://ftp.debian.org/debian/dists/README",
- descr="sample descr",
- destFile="/tmp/lala2")
-fetcher.Run()
+get_file(fetcher, "ftp://ftp.debian.org/debian/dists/README", "/tmp/lala")
sys.exit(1)
pm.GetArchives(fetcher,list,recs)
diff --git a/python/acquire.cc b/python/acquire.cc
index 97064c43..65f8f2d7 100644
--- a/python/acquire.cc
+++ b/python/acquire.cc
@@ -250,12 +250,11 @@ PyObject *GetPkgAcqFile(PyObject *Self, PyObject *Args, PyObject * kwds)
uri = md5 = descr = shortDescr = destDir = destFile = "";
char * kwlist[] = {"owner","uri", "md5", "size", "descr", "shortDescr",
- "destDir", "destFile", NULL};
+ NULL};
- if (PyArg_ParseTupleAndKeywords(Args, kwds, "O!s|sissss", kwlist,
+ if (PyArg_ParseTupleAndKeywords(Args, kwds, "O!s|siss", kwlist,
&PkgAcquireType, &pyfetcher, &uri, &md5,
- &size, &descr, &shortDescr, &destDir,
- &destFile) == 0)
+ &size, &descr, &shortDescr) == 0)
return 0;
pkgAcquire *fetcher = GetCpp<pkgAcquire*>(pyfetcher);
@@ -264,10 +263,7 @@ PyObject *GetPkgAcqFile(PyObject *Self, PyObject *Args, PyObject * kwds)
md5, // md5
size, // size
descr, // descr
- shortDescr, // shortdescr
- destDir, // destdir
- destFile // destfile
- );
+ shortDescr); // short-desc
CppPyObject<pkgAcqFile*> *AcqFileObj = CppPyObject_NEW<pkgAcqFile*>(&PkgAcquireFileType);
AcqFileObj->Object = af;