summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Heinlein <sebi@sebi-laptop>2006-12-27 11:24:27 +0100
committerSebastian Heinlein <sebi@sebi-laptop>2006-12-27 11:24:27 +0100
commit7578fa1808f28ecfc18ef3abe9a9aaee18f13421 (patch)
tree918d7d4a021ac35d6d01f082eb6536523d395664
parentbfbaf01b3eb6c14491ca8113bdaef9ef337e462a (diff)
downloadpython-apt-7578fa1808f28ecfc18ef3abe9a9aaee18f13421.tar.gz
* Remove obsolete classes MatchType and MatchDist
* add a is_mirror method to the Suite class (not complete yet) * make use of the new is_mirror method in the matcher * the components of a suite are now stored in alist with instances of the class Components and not in a dict anymore * fix a reference to the obsolete DescriptionLong (was replaced by Description/ShortDescription)
-rw-r--r--AptSources/DistInfo.py14
-rw-r--r--AptSources/aptsources.py24
2 files changed, 15 insertions, 23 deletions
diff --git a/AptSources/DistInfo.py b/AptSources/DistInfo.py
index 8e1cf903..bbeee374 100644
--- a/AptSources/DistInfo.py
+++ b/AptSources/DistInfo.py
@@ -48,6 +48,14 @@ class Suite:
def has_component(self, comp):
''' Check if the distribution provides the given component '''
return comp in map(lambda c: c.name, self.components)
+
+ def is_mirror(self, url):
+ ''' Check if a given url of a repository is a valid mirror '''
+ url_splitted = split_url(url)
+ if self.mirror_set.has_key(url_splitted[1]):
+ return True
+ else:
+ return False
class Component:
def __init__(self, name, desc=None, short_desc=None):
@@ -189,13 +197,11 @@ class DistInfo:
component = Component(value)
elif field == 'CompDescription':
component.set_description(_(value))
- elif field == 'CompDescriptionLong':
+ elif field == 'CompDescriptionShort':
component.set_short_description(_(value))
if suite:
if component:
- suite.components["%s" % component.name] = \
- (component.description,
- component.description_long)
+ suite.components.append(component)
component = None
self.suites.append (suite)
suite = None
diff --git a/AptSources/aptsources.py b/AptSources/aptsources.py
index 748f6aaf..2b1b70e9 100644
--- a/AptSources/aptsources.py
+++ b/AptSources/aptsources.py
@@ -376,19 +376,6 @@ class SourcesList:
# matcher class to make a source entry look nice
# lots of predefined matchers to make it i18n/gettext friendly
class SourceEntryMatcher:
- class MatchType:
- def __init__(self, a_type,a_descr):
- self.type = a_type
- self.description = a_descr
-
- class MatchDist:
- def __init__(self,a_uri,a_dist, a_descr,l_comps, l_comps_descr):
- self.uri = a_uri
- self.dist = a_dist
- self.description = a_descr
- self.comps = l_comps
- self.comps_descriptions = l_comps_descr
-
def __init__(self, matcherPath):
self.templates = []
# Get the human readable channel and comp names from the channel .infos
@@ -413,12 +400,11 @@ class SourceEntryMatcher:
found = True
source.template = template
break
- for mirror in template.valid_mirrors:
- if (is_mirror(mirror,source.uri) and
- re.match(template.match_name, source.dist)):
- found = True
- source.template = template
- break
+ elif (template.is_mirror(source.uri) and
+ re.match(template.match_name, source.dist)):
+ found = True
+ source.template = template
+ break
return found
class Distribution: