diff options
| author | Stephan Peijnik <debian@sp.or.at> | 2009-06-29 11:08:36 +0200 |
|---|---|---|
| committer | Stephan Peijnik <debian@sp.or.at> | 2009-06-29 11:08:36 +0200 |
| commit | 8e1755030e5c00bcb183213ada7084fb0f5f6be9 (patch) | |
| tree | 997869b9a68c6367ddcd10b6785dfa65adf54c5f | |
| parent | 80f3ac59823b31be89dcb52b5ba38aa27d48121f (diff) | |
| parent | 1928a8fab432b219c6286ff08b142c57c6df5e6b (diff) | |
| download | python-apt-8e1755030e5c00bcb183213ada7084fb0f5f6be9.tar.gz | |
Merged with lp:python-apt.
| -rw-r--r-- | apt/cache.py | 25 | ||||
| -rw-r--r-- | debian/changelog | 5 | ||||
| -rw-r--r-- | python/progress.cc | 5 |
3 files changed, 34 insertions, 1 deletions
diff --git a/apt/cache.py b/apt/cache.py index cc425ccb..94a77fd8 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -60,8 +60,33 @@ class Cache(object): apt_pkg.Config.Set("Dir", rootdir) apt_pkg.Config.Set("Dir::State::status", rootdir + "/var/lib/dpkg/status") + # create required dirs/files when run with special rootdir + # automatically + self._check_and_create_required_dirs(rootdir) self.open(progress) + def _check_and_create_required_dirs(self, rootdir): + """ + check if the required apt directories/files are there and if + not create them + """ + files = ["/var/lib/dpkg/status", + "/etc/apt/sources.list", + ] + dirs = ["/var/lib/dpkg", + "/etc/apt/", + "/var/cache/apt/archives/partial", + "/var/lib/apt/lists/partial", + ] + for d in dirs: + if not os.path.exists(rootdir+d): + print "creating: ",rootdir+d + os.makedirs(rootdir+d) + for f in files: + if not os.path.exists(rootdir+f): + open(rootdir+f,"w") + + def _runCallbacks(self, name): """ internal helper to run a callback """ if name in self._callbacks: diff --git a/debian/changelog b/debian/changelog index a3faab79..0f9463b2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -99,8 +99,13 @@ python-apt (0.7.9) unstable; urgency=low closes: #497049 * apt/package.py: - avoid uneeded interal references in the Package objects + * python/progress.cc: + - fix crash in RunSimpleCallback() * aptsources/sourceslist.py: - fix bug in invalid lines detection (LP: #324614) + * apt/cache.py: + - when the cache is run with a alternative rootdir, create + required dirs/files automatically -- Michael Vogt <mvo@debian.org> Thu, 19 Mar 2009 13:39:21 +0100 diff --git a/python/progress.cc b/python/progress.cc index 14948d3c..95cece3b 100644 --- a/python/progress.cc +++ b/python/progress.cc @@ -27,9 +27,12 @@ bool PyCallbackObj::RunSimpleCallback(const char* method_name, PyObject *method = PyObject_GetAttrString(callbackInst,(char*) method_name); if(method == NULL) { - // FIXME: make this silent //std::cerr << "Can't find '" << method_name << "' method" << std::endl; Py_XDECREF(arglist); + if (res) { + Py_INCREF(Py_None); + *res = Py_None; + } return false; } PyObject *result = PyEval_CallObject(method, arglist); |
