summaryrefslogtreecommitdiff
path: root/SoftwareProperties/aptsources.py
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-03-27 21:25:05 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2006-03-27 21:25:05 +0200
commit01c2875f19b40695b75c1014f4d1adc536c081fe (patch)
tree02c420b9e6bdbcb912682ee4f949fc7c304c5233 /SoftwareProperties/aptsources.py
parentbd4359789d0e72fbbcd49f22b7f535e9238f3f93 (diff)
downloadpython-apt-01c2875f19b40695b75c1014f4d1adc536c081fe.tar.gz
* small fixes
Diffstat (limited to 'SoftwareProperties/aptsources.py')
-rw-r--r--SoftwareProperties/aptsources.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/SoftwareProperties/aptsources.py b/SoftwareProperties/aptsources.py
index 3e82c74b..933d9960 100644
--- a/SoftwareProperties/aptsources.py
+++ b/SoftwareProperties/aptsources.py
@@ -189,24 +189,6 @@ class SourceEntry:
line += "\n"
return line
- def add(self, type, uri, dist, comps, comment="", pos=-1):
- # if there is a repo with the same (type, uri, dist) just add the
- # components
- for i in self.list:
- if i.type == type and is_mirror(uri,i.uri) and i.dist == dist:
- comps = uniq(i.comps + comps)
- # set to the old position and preserve comment
- comment = i.comment
- pos = self.list.index(i)
- self.list.remove(i)
- line = "%s %s %s" % (type,uri,dist)
- for c in comps:
- line = line + " " + c;
- if comment != "":
- line = "%s #%s\n" %(line,comment)
- line = line + "\n"
- self.list.insert(pos, SourceEntry(line))
-
# the SourceList file as a class
class SourcesList:
def __init__(self):
@@ -229,6 +211,24 @@ class SourcesList:
yield entry
raise StopIteration
+ def add(self, type, uri, dist, comps, comment="", pos=-1):
+ # if there is a repo with the same (type, uri, dist) just add the
+ # components
+ for i in self.list:
+ if i.type == type and is_mirror(uri,i.uri) and i.dist == dist:
+ comps = uniq(i.comps + comps)
+ # set to the old position and preserve comment
+ comment = i.comment
+ pos = self.list.index(i)
+ self.list.remove(i)
+ line = "%s %s %s" % (type,uri,dist)
+ for c in comps:
+ line = line + " " + c;
+ if comment != "":
+ line = "%s #%s\n" %(line,comment)
+ line = line + "\n"
+ self.list.insert(pos, SourceEntry(line))
+
def remove(self, source_entry):
self.list.remove(source_entry)