summaryrefslogtreecommitdiff
path: root/aptsources
diff options
context:
space:
mode:
authorBen Finney <ben@benfinney.id.au>2008-05-16 20:12:36 +1000
committerBen Finney <ben@benfinney.id.au>2008-05-16 20:12:36 +1000
commitf264f62b7602f960bc35f3f68b1ed14c61bbfdd5 (patch)
tree1ee94164129169dda7273fb6553bef2a670d3d62 /aptsources
parent97c3c24b3060e8280fffed68ed60a68e04f382ca (diff)
downloadpython-apt-f264f62b7602f960bc35f3f68b1ed14c61bbfdd5.tar.gz
Limit code lines to maximum 79 characters, to conform with PEP 8.
Diffstat (limited to 'aptsources')
-rw-r--r--aptsources/distinfo.py10
-rw-r--r--aptsources/distro.py33
-rw-r--r--aptsources/sourceslist.py26
3 files changed, 42 insertions, 27 deletions
diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py
index ce90faac..3bdbd653 100644
--- a/aptsources/distinfo.py
+++ b/aptsources/distinfo.py
@@ -154,7 +154,9 @@ class DistInfo:
location = None
match_loc = re.compile(r"^#LOC:(.+)$")
- match_mirror_line = re.compile(r"^(#LOC:.+)|(((http)|(ftp)|(rsync)|(file)|(https))://[A-Za-z/\.:\-_]+)$")
+ match_mirror_line = re.compile(
+ r"^(#LOC:.+)|(((http)|(ftp)|(rsync)|(file)|(https))://"
+ r"[A-Za-z/\.:\-_]+)$")
#match_mirror_line = re.compile(r".+")
if not dist:
@@ -185,7 +187,8 @@ class DistInfo:
self.metarelease_uri = value
elif field == 'Suite':
if template:
- if component and not template.has_component(component.name):
+ if component \
+ and not template.has_component(component.name):
template.components.append(component)
component = None
self.templates.append(template)
@@ -231,7 +234,8 @@ class DistInfo:
if mirror_set.has_key(hostname):
mirror_set[hostname].add_repository(proto, dir)
else:
- mirror_set[hostname] = Mirror(proto, hostname, dir, location)
+ mirror_set[hostname] = Mirror(
+ proto, hostname, dir, location)
map_mirror_sets[value] = mirror_set
template.mirror_set = map_mirror_sets[value]
elif field == 'Description':
diff --git a/aptsources/distro.py b/aptsources/distro.py
index 888e6e06..f631e285 100644
--- a/aptsources/distro.py
+++ b/aptsources/distro.py
@@ -82,7 +82,8 @@ class Distribution:
if self.is_codename(template.name) and\
template.distribution == self.id:
#print "yeah! found a template for %s" % self.description
- #print template.description, template.base_uri, template.components
+ #print template.description, template.base_uri, \
+ # template.components
self.source_template = template
break
if self.source_template == None:
@@ -117,15 +118,19 @@ class Distribution:
elif source.type == self.binary_type and \
source.disabled == True:
self.disabled_sources.append(source)
- elif source.type == self.source_type and source.disabled == False:
+ elif source.type == self.source_type \
+ and source.disabled == False:
self.source_code_sources.append(source)
- elif source.type == self.source_type and source.disabled == True:
+ elif source.type == self.source_type \
+ and source.disabled == True:
self.disabled_sources.append(source)
if source.invalid == False and\
source.template in self.source_template.children:
- if source.disabled == False and source.type == self.binary_type:
+ if source.disabled == False \
+ and source.type == self.binary_type:
self.child_sources.append(source)
- elif source.disabled == False and source.type == self.source_type:
+ elif source.disabled == False \
+ and source.type == self.source_type:
self.source_code_sources.append(source)
else:
self.disabled_sources.append(source)
@@ -240,11 +245,12 @@ class Distribution:
self.nearest_server, False])
mirrors.append([_("Custom servers"), None, True])
for server in self.used_servers:
+ mirror_entry = [self._get_mirror_name(server), server, False]
if compare_mirrors(server, self.nearest_server) or\
compare_mirrors(server, self.main_server):
continue
- elif not [self._get_mirror_name(server), server, False] in mirrors:
- mirrors.append([self._get_mirror_name(server), server, False])
+ elif not mirror_entry in mirrors:
+ mirrors.append(mirror_entry)
return mirrors
@@ -408,23 +414,22 @@ class DebianDistribution(Distribution):
country = server[i+len("://ftp."):l]
if self.countries.has_key(country):
# TRANSLATORS: %s is a country
- return _("Server for %s") % \
- gettext.dgettext("iso_3166",
- self.countries[country].rstrip()).rstrip()
+ return _("Server for %s") % gettext.dgettext(
+ "iso_3166", self.countries[country].rstrip()).rstrip()
else:
return("%s" % server.rstrip("/ "))
def get_mirrors(self):
- Distribution.get_mirrors(self,
- mirror_template="http://ftp.%s.debian.org/debian/")
+ Distribution.get_mirrors(
+ self, mirror_template="http://ftp.%s.debian.org/debian/")
class UbuntuDistribution(Distribution):
''' Class to support specific Ubuntu features '''
def get_mirrors(self):
- Distribution.get_mirrors(self,
- mirror_template="http://%s.archive.ubuntu.com/ubuntu/")
+ Distribution.get_mirrors(
+ self, mirror_template="http://%s.archive.ubuntu.com/ubuntu/")
def get_distro():
diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py
index 6eb69f6e..be17cd1f 100644
--- a/aptsources/sourceslist.py
+++ b/aptsources/sourceslist.py
@@ -84,11 +84,13 @@ class SourceEntry:
self.type = "" # what type (deb, deb-src)
self.uri = "" # base-uri
self.dist = "" # distribution (dapper, edgy, etc)
- self.comps = [] # list of available componetns (may empty)
+ self.comps = [] # list of available componetns
+ # (may empty)
self.comment = "" # (optional) comment
self.line = line # the original sources.list line
if file == None:
- file = apt_pkg.Config.FindDir("Dir::Etc")+apt_pkg.Config.Find("Dir::Etc::sourcelist")
+ file = apt_pkg.Config.FindDir(
+ "Dir::Etc")+apt_pkg.Config.Find("Dir::Etc::sourcelist")
self.file = file # the file that the entry is located in
self.parse(line)
self.template = None # type DistInfo.Suite
@@ -118,11 +120,13 @@ class SourceEntry:
elif line[i] == "]":
p_found=False
tmp += line[i]
- elif space_found and not line[i].isspace(): # we skip one or more space
+ elif space_found and not line[i].isspace():
+ # we skip one or more space
space_found = False
pieces.append(tmp)
tmp = line[i]
- elif line[i].isspace() and not p_found: # found a whitespace
+ elif line[i].isspace() and not p_found:
+ # found a whitespace
space_found = True
else:
tmp += line[i]
@@ -273,8 +277,8 @@ class SourcesList:
source.dist == dist:
for new_comp in comps:
if new_comp in source.comps:
- # we have this component already, delete it from the new_comps
- # list
+ # we have this component already, delete it
+ # from the new_comps list
del comps[comps.index(new_comp)]
if len(comps) == 0:
return source
@@ -332,7 +336,8 @@ class SourcesList:
if backup_ext == None:
backup_ext = time.strftime("%y%m%d.%H%M")
for source in self.list:
- if not source.file in already_backuped and os.path.exists(source.file):
+ if not source.file in already_backuped \
+ and os.path.exists(source.file):
shutil.copy(source.file, "%s%s" % (source.file, backup_ext))
return backup_ext
@@ -356,9 +361,10 @@ class SourcesList:
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")
+ 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: