summaryrefslogtreecommitdiff
path: root/aptsources
diff options
context:
space:
mode:
Diffstat (limited to 'aptsources')
-rw-r--r--aptsources/distinfo.py4
-rw-r--r--aptsources/distro.py42
-rw-r--r--aptsources/sourceslist.py41
3 files changed, 43 insertions, 44 deletions
diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py
index b03e68f8..8fcbac96 100644
--- a/aptsources/distinfo.py
+++ b/aptsources/distinfo.py
@@ -254,8 +254,8 @@ class DistInfo(object):
template.description = _(value)
elif field == 'Component':
if (component and not
- template.has_component(component.name)):
- template.components.append(component)
+ template.has_component(component.name)):
+ template.components.append(component)
component = Component(value)
elif field == 'CompDescription':
component.set_description(_(value))
diff --git a/aptsources/distro.py b/aptsources/distro.py
index 9b48a10f..f75aa06b 100644
--- a/aptsources/distro.py
+++ b/aptsources/distro.py
@@ -77,7 +77,7 @@ class Distribution(object):
# find the distro template
for template in self.sourceslist.matcher.templates:
if (self.is_codename(template.name) and
- template.distribution == self.id):
+ template.distribution == self.id):
#print "yeah! found a template for %s" % self.description
#print template.description, template.base_uri, \
# template.components
@@ -96,40 +96,40 @@ class Distribution(object):
#source_code = []
for source in self.sourceslist.list:
if (not source.invalid and
- self.is_codename(source.dist) and
- source.template and
- source.template.official and
- self.is_codename(source.template.name)):
+ self.is_codename(source.dist) and
+ source.template and
+ source.template.official and
+ self.is_codename(source.template.name)):
#print "yeah! found a distro repo: %s" % source.line
# cdroms need do be handled differently
if (source.uri.startswith("cdrom:") and
- not source.disabled):
- self.cdrom_sources.append(source)
- cdrom_comps.extend(source.comps)
+ not source.disabled):
+ self.cdrom_sources.append(source)
+ cdrom_comps.extend(source.comps)
elif (source.uri.startswith("cdrom:") and
- source.disabled):
+ source.disabled):
self.cdrom_sources.append(source)
elif (source.type == self.binary_type and
- not source.disabled):
+ not source.disabled):
self.main_sources.append(source)
comps.extend(source.comps)
media.append(source.uri)
elif (source.type == self.binary_type and
- source.disabled):
+ source.disabled):
self.disabled_sources.append(source)
- elif (source.type == self.source_type
- and not source.disabled):
+ elif (source.type == self.source_type and
+ not source.disabled):
self.source_code_sources.append(source)
elif (source.type == self.source_type and
- source.disabled):
+ source.disabled):
self.disabled_sources.append(source)
if (not source.invalid and
- source.template in self.source_template.children):
+ source.template in self.source_template.children):
if (not source.disabled
- and source.type == self.binary_type):
- self.child_sources.append(source)
+ and source.type == self.binary_type):
+ self.child_sources.append(source)
elif (not source.disabled
- and source.type == self.source_type):
+ and source.type == self.source_type):
self.source_code_sources.append(source)
else:
self.disabled_sources.append(source)
@@ -256,9 +256,9 @@ class Distribution(object):
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)):
+ compare_mirrors(server, self.main_server)):
continue
- elif not mirror_entry in mirrors:
+ elif mirror_entry not in mirrors:
mirrors.append(mirror_entry)
return mirrors
@@ -405,7 +405,7 @@ class Distribution(object):
for source in self.child_sources:
# Do not change the forces server of a child source
if (source.template.base_uri is None or
- source.template.base_uri != source.uri):
+ source.template.base_uri != source.uri):
change_server_of_source(source, uri, seen_binary)
for source in self.source_code_sources:
change_server_of_source(source, uri, seen_source)
diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py
index 91ce8eff..842b1451 100644
--- a/aptsources/sourceslist.py
+++ b/aptsources/sourceslist.py
@@ -87,23 +87,22 @@ class SourceEntry(object):
""" single sources.list entry """
def __init__(self, line, file=None):
- self.invalid = False # is the source entry valid
- self.disabled = False # is it disabled ('#' in front)
- self.type = "" # what type (deb, deb-src)
- self.architectures = [] # architectures
- self.trusted = None # Trusted
- self.uri = "" # base-uri
- self.dist = "" # distribution (dapper, edgy, etc)
- self.comps = [] # list of available componetns
- # (may empty)
- self.comment = "" # (optional) comment
- self.line = line # the original sources.list line
+ self.invalid = False # is the source entry valid
+ self.disabled = False # is it disabled ('#' in front)
+ self.type = "" # what type (deb, deb-src)
+ self.architectures = [] # architectures
+ self.trusted = None # Trusted
+ self.uri = "" # base-uri
+ self.dist = "" # distribution (dapper, edgy, etc)
+ self.comps = [] # list of available componetns (may empty)
+ self.comment = "" # (optional) comment
+ self.line = line # the original sources.list line
if file is None:
file = apt_pkg.config.find_dir(
"Dir::Etc") + apt_pkg.config.find("Dir::Etc::sourcelist")
- self.file = file # the file that the entry is located in
+ self.file = file # the file that the entry is located in
self.parse(line)
- self.template = None # type DistInfo.Suite
+ self.template = None # type DistInfo.Suite
self.children = []
def __eq__(self, other):
@@ -301,7 +300,7 @@ class SourcesList(object):
def __find(self, *predicates, **attrs):
for source in self.list:
if (all(getattr(source, key) == attrs[key] for key in attrs) and
- all(predicate(source) for predicate in predicates)):
+ all(predicate(source) for predicate in predicates)):
yield source
def add(self, type, uri, dist, orig_comps, comment="", pos=-1, file=None,
@@ -379,8 +378,8 @@ class SourcesList(object):
if backup_ext is 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 (source.file not in already_backuped
+ and os.path.exists(source.file)):
shutil.copy(source.file, "%s%s" % (source.file, backup_ext))
return backup_ext
@@ -467,15 +466,15 @@ class SourceEntryMatcher(object):
found = False
for template in self.templates:
if (re.search(template.match_uri, source.uri) and
- re.match(template.match_name, source.dist) and
- # deb is a valid fallback for deb-src (if that is not
- # definied, see #760035
- (source.type == template.type or template.type == "deb")):
+ re.match(template.match_name, source.dist) and
+ # deb is a valid fallback for deb-src (if that is not
+ # definied, see #760035
+ (source.type == template.type or template.type == "deb")):
found = True
source.template = template
break
elif (template.is_mirror(source.uri) and
- re.match(template.match_name, source.dist)):
+ re.match(template.match_name, source.dist)):
found = True
source.template = template
break