diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2009-07-20 15:37:25 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2009-07-20 15:37:25 +0200 |
| commit | 8f9c131d127a59e5ea4ce3eed8d96be1766399f0 (patch) | |
| tree | e796847cae94cb1a1ca93339a085b395a981503f /apt/cache.py | |
| parent | 87f6d28c1555ee70da9dddb9625cea0c4d6ab9a5 (diff) | |
| parent | 53f514317550cc09ad3c3fb9503be51d88e3d31d (diff) | |
| download | python-apt-8f9c131d127a59e5ea4ce3eed8d96be1766399f0.tar.gz | |
* apt/progress/__init__.py:
- add update_status_full() that takes file_size/partial_size as
additional callback arguments
- add pulse_items() that takes a addtional "items" tuple that
gives the user full access to the individual items that are
fetched
* python/progress.cc:
- low level code for update_status_full and pulse_items()
- better threading support
* aptsources/distro.py:
- fix indent error that causes incorrect sources.list additons
(LP: #372224)
* python/progress.cc:
- fix crash in RunSimpleCallback()
* apt/cache.py:
- when the cache is run with a alternative rootdir, create
required dirs/files automatically
Diffstat (limited to 'apt/cache.py')
| -rw-r--r-- | apt/cache.py | 25 |
1 files changed, 25 insertions, 0 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: |
