From 020a3e602fa07858410cbbaa81fab3ed4a03e20d Mon Sep 17 00:00:00 2001 From: Sebastian Heinlein Date: Fri, 2 Feb 2007 20:01:39 +0100 Subject: * change all obsolete references to the former python-aptsources --- aptsources/distinfo.py | 2 +- aptsources/sourceslist.py | 2 +- data/templates/Debian.info.in | 12 ++++++------ data/templates/Ubuntu.info.in | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py index 7568b558..d7289b4b 100644 --- a/aptsources/distinfo.py +++ b/aptsources/distinfo.py @@ -117,7 +117,7 @@ def split_url(url): class DistInfo: def __init__(self, dist = None, - base_dir = "/usr/share/python-aptsources/templates"): + base_dir = "/usr/share/python-apt/templates"): self.metarelease_uri = '' self.templates = [] diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 14c2a0ea..800f462f 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -219,7 +219,7 @@ class SourcesList: """ represents the full sources.list + sources.list.d file """ def __init__(self, withMatcher=True, - matcherPath="/usr/share/python-aptsources/templates/"): + matcherPath="/usr/share/python-apt/templates/"): self.list = [] # the actual SourceEntries Type if withMatcher: self.matcher = SourceEntryMatcher(matcherPath) diff --git a/data/templates/Debian.info.in b/data/templates/Debian.info.in index 8a2eead3..244e1c6b 100644 --- a/data/templates/Debian.info.in +++ b/data/templates/Debian.info.in @@ -4,7 +4,7 @@ Suite: etch RepositoryType: deb BaseURI: http://http.us.debian.org/debian/ MatchUri: ftp[0-9]*\.[a-z]\.debian\.org -MirrorsFile: /usr/share/python-aptsources/templates/Debian.mirrors +MirrorsFile: /usr/share/python-apt/templates/Debian.mirrors _Description: Debian 4.0 'Etch' Component: main _CompDescription: Officially supported @@ -27,7 +27,7 @@ Suite: sarge RepositoryType: deb BaseURI: http://http.us.debian.org/debian/ MatchUri: ftp[0-9]*\.[a-z]\.debian\.org -MirrorsFile: /usr/share/python-aptsources/templates/Debian.mirrors +MirrorsFile: /usr/share/python-apt/templates/Debian.mirrors _Description: Debian 3.1 'Sarge' Component: main _CompDescription: Officially supported @@ -50,7 +50,7 @@ Suite: stable RepositoryType: deb BaseURI: http://http.us.debian.org/debian/ MatchUri: ftp[0-9]*\.[a-z]\.debian\.org -MirrorsFile: /usr/share/python-aptsources/templates/Debian.mirrors +MirrorsFile: /usr/share/python-apt/templates/Debian.mirrors _Description: Debian current stable release Component: main _CompDescription: Officially supported @@ -63,7 +63,7 @@ Suite: testing RepositoryType: deb BaseURI: http://http.us.debian.org/debian/ MatchUri: ftp[0-9]*\.[a-z]\.debian\.org -MirrorsFile: /usr/share/python-aptsources/templates/Debian.mirrors +MirrorsFile: /usr/share/python-apt/templates/Debian.mirrors _Description: Debian testing Component: main _CompDescription: Officially supported @@ -76,7 +76,7 @@ Suite: sid RepositoryType: deb BaseURI: http://http.us.debian.org/debian/ MatchUri: ftp[0-9]*\.[a-z]\.debian\.org -MirrorsFile: /usr/share/python-aptsources/templates/Debian.mirrors +MirrorsFile: /usr/share/python-apt/templates/Debian.mirrors _Description: Debian 'Sid' (unstable) Component: main _CompDescription: Officially supported @@ -88,7 +88,7 @@ _CompDescription: Non-DFSG-compatible Software Suite: unstable RepositoryType: deb BaseURI: http://http.us.debian.org/debian/ -MirrorsFile: /usr/share/python-aptsources/templates/Debian.mirrors +MirrorsFile: /usr/share/python-apt/templates/Debian.mirrors _Description: Debian 'Sid' (unstable) Component: main _CompDescription: Officially supported diff --git a/data/templates/Ubuntu.info.in b/data/templates/Ubuntu.info.in index fa76879f..56a02436 100644 --- a/data/templates/Ubuntu.info.in +++ b/data/templates/Ubuntu.info.in @@ -4,7 +4,7 @@ Suite: feisty RepositoryType: deb BaseURI: http://archive.ubuntu.com/ubuntu/ MatchURI: archive.ubuntu.com/ubuntu -MirrorsFile: /usr/share/python-aptsources/templates/Ubuntu.mirrors +MirrorsFile: /usr/share/python-apt/templates/Ubuntu.mirrors _Description: Ubuntu 7.04 'Feisty Fawn' Component: main _CompDescription: Officially supported @@ -55,7 +55,7 @@ Suite: edgy RepositoryType: deb BaseURI: http://archive.ubuntu.com/ubuntu/ MatchURI: archive.ubuntu.com/ubuntu -MirrorsFile: /usr/share/python-aptsources/templates/Ubuntu.mirrors +MirrorsFile: /usr/share/python-apt/templates/Ubuntu.mirrors _Description: Ubuntu 6.10 'Edgy Eft' Component: main _CompDescription: Officially supported @@ -106,7 +106,7 @@ Suite: dapper RepositoryType: deb BaseURI: http://archive.ubuntu.com/ubuntu/ MatchURI: archive.ubuntu.com/ubuntu -MirrorsFile: /usr/share/python-aptsources/templates/Ubuntu.mirrors +MirrorsFile: /usr/share/python-apt/templates/Ubuntu.mirrors _Description: Ubuntu 6.06 LTS 'Dapper Drake' Component: main _CompDescription: Officially supported @@ -157,7 +157,7 @@ Suite: breezy RepositoryType: deb BaseURI: http://archive.ubuntu.com/ubuntu/ MatchURI: archive.ubuntu.com/ubuntu -MirrorsFile: /usr/share/python-aptsources/templates/Ubuntu.mirrors +MirrorsFile: /usr/share/python-apt/templates/Ubuntu.mirrors _Description: Ubuntu 5.10 'Breezy Badger' Component: main _CompDescription: Officially supported @@ -199,7 +199,7 @@ Suite: hoary RepositoryType: deb BaseURI: http://archive.ubuntu.com/ubuntu/ MatchURI: archive.ubuntu.com/ubuntu -MirrorsFile: /usr/share/python-aptsources/templates/Ubuntu.mirrors +MirrorsFile: /usr/share/python-apt/templates/Ubuntu.mirrors _Description: Ubuntu 5.04 'Hoary Hedgehog' Component: main _CompDescription: Officially supported -- cgit v1.2.3 From 3ee70c61924e65e3c4ef6bf0fa0673d2e866b042 Mon Sep 17 00:00:00 2001 From: Sebastian Heinlein Date: Mon, 5 Feb 2007 09:19:39 +0100 Subject: * write an empty default sources.list if all sources have been removed --- aptsources/distro.py | 1 - aptsources/sourceslist.py | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/aptsources/distro.py b/aptsources/distro.py index 5b4c6522..f53783dc 100644 --- a/aptsources/distro.py +++ b/aptsources/distro.py @@ -244,7 +244,6 @@ class Distribution: if comp in self.cdrom_comps: sources = [] sources.extend(self.main_sources) - for source in sources: if comp in source.comps: source.comps.remove(comp) diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 14c2a0ea..e5b8dab9 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -342,6 +342,15 @@ class SourcesList: def save(self): """ save the current sources """ files = {} + # write an empty default config file if there aren't any sources + if len(self.list) == 0: + path = "%s%s" % (apt_pkg.Config.FindDir("Dir::Etc"), + apt_pkg.Config.Find("Dir::Etc::sourcelist")) + header = ("## See sources.list(5) for more information, especialy\n" + "# Remember that you can only use http, ftp or file URIs\n" + "# CDROMs are managed through the apt-cdrom tool.\n") + open(path,"w").write(header) + return for source in self.list: if not files.has_key(source.file): files[source.file]=open(source.file,"w") -- cgit v1.2.3