diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2008-11-10 11:37:22 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2008-11-10 11:37:22 +0100 |
| commit | 2ffb67326afc5a404e14e4fa1cb57f341e9fea94 (patch) | |
| tree | cd3dcc8c3e164b65f4b23e43b90ed225d829b1ac /aptsources | |
| parent | 01582092da5613022a4ef43751f38306957c7480 (diff) | |
| parent | 969986c30b34fc47b47a9ca2c9e1cd6ab38fe5ea (diff) | |
| download | python-apt-2ffb67326afc5a404e14e4fa1cb57f341e9fea94.tar.gz | |
* python/metaindex.cc
- fix crash when incorrect attribute is given
* data/templates/Ubuntu.info.in:
- updated to fix ports.ubuntu.com for powerpc and lpia
(LP: #220890)
* aptsources/distro.py:
- add parameter to get_distro() to make unit testing easier
* tests/test_aptsources_ports.py:
- add test for arch specific handling (when sub arch is on
a different mirror than "main" arches)
* python/acquire.cc (GetPkgAcqFile): Support DestDir and DestFilename.
Diffstat (limited to 'aptsources')
| -rw-r--r-- | aptsources/distro.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/aptsources/distro.py b/aptsources/distro.py index 6d3b453f..f271bbc4 100644 --- a/aptsources/distro.py +++ b/aptsources/distro.py @@ -414,15 +414,22 @@ class UbuntuDistribution(Distribution): Distribution.get_mirrors(self, mirror_template="http://%s.archive.ubuntu.com/ubuntu/") -def get_distro(): - ''' Check the currently used distribution and return the corresponding - distriubtion class that supports distro specific features. ''' - lsb_info = [] - for lsb_option in ["-i", "-c", "-d", "-r"]: +def get_distro(id=None,codename=None,description=None,release=None): + """ + Check the currently used distribution and return the corresponding + distriubtion class that supports distro specific features. + + If no paramter are given the distro will be auto detected via + a call to lsb-release + """ + # make testing easier + if not (id and codename and description and release): + lsb_info = [] + for lsb_option in ["-i", "-c", "-d", "-r"]: pipe = os.popen("lsb_release %s -s" % lsb_option) lsb_info.append(pipe.read().strip()) del pipe - (id, codename, description, release) = lsb_info + (id, codename, description, release) = lsb_info if id == "Ubuntu": return UbuntuDistribution(id, codename, description, release) |
