summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2007-03-23 17:00:50 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2007-03-23 17:00:50 +0100
commit8096462f7129b027cfc12150fa18f7cc68daf360 (patch)
treeacad35ce44ec0cde507d6dd4cce461a5c51b5b62
parent6bc3d1c5dd643fd3fd29ec2319cbdef6fe721d25 (diff)
parentbf5f2b17ba2dbb17af7e88b824482e9d9161d47d (diff)
downloadpython-apt-8096462f7129b027cfc12150fa18f7cc68daf360.tar.gz
* remove an oboslete function
* fix the url comparision with trainling slashes - LP#95031
-rw-r--r--aptsources/distro.py55
-rw-r--r--aptsources/sourceslist.py5
-rw-r--r--debian/changelog7
3 files changed, 18 insertions, 49 deletions
diff --git a/aptsources/distro.py b/aptsources/distro.py
index fe9b4d75..45a7172d 100644
--- a/aptsources/distro.py
+++ b/aptsources/distro.py
@@ -26,7 +26,7 @@ import gettext
import re
import os
import sys
-#from gettext import gettext as _
+
import gettext
def _(s): return gettext.dgettext("python-apt", s)
@@ -282,41 +282,6 @@ class Distribution:
else:
return False
- def get_server_list(self):
- ''' Return a list of used and suggested servers '''
- # Store all available servers:
- # Name, URI, active
- mirrors = []
-
- mirrors.append([_("Main server"), self.main_server,
- len(self.used_servers) == 1 and
- self.used_servers[0] == self.main_server])
-
- if len(self.used_servers) == 1 and not re.match(self.used_servers[0],
- self.main_server):
- # Only one server is used
- server = self.used_servers[0]
- mirrors.append([server, server, True])
- elif len(self.used_servers) > 1:
- # More than one server is used. Since we don't handle this case
- # in the user interface we set "custom servers" to true and
- # append a list of all used servers
- mirrors.append([_("Custom servers"), None, True])
- for server in self.used_servers:
- if not [server, server, False] in mirrors:
- mirrors.append([server, server, False])
-
- return mirrors
-
- if len(self.used_servers) == 1 and not is_single_server(self.main_server):
- mirrors.append(["%s" % self.used_servers[0],
- self.used_servers[0], True])
- elif len(self.used_servers) > 1 or not is_single_server(self.main_server):
- mirrors.append([_("Custom servers"), None, True])
-
- return mirrors
-
-
class DebianDistribution(Distribution):
''' Class to support specific Debian features '''
@@ -362,7 +327,10 @@ class UbuntuDistribution(Distribution):
def get_server_list(self):
''' Return a list of used and suggested servers '''
-
+ def compare_mirrors(mir1, mir2):
+ '''Helper function that handles comaprision of mirror urls
+ that could contain trailing slashes'''
+ return re.match(mir1.strip("/ "), mir2.rstrip("/ "))
def get_mirror_name(server):
''' Try to get a human readable name for the main mirror of a country'''
country = None
@@ -376,25 +344,25 @@ class UbuntuDistribution(Distribution):
gettext.dgettext("iso-3166",
self.countries[country].rstrip()).rstrip()
else:
- return("%s" % server)
+ return("%s" % server.rstrip("/ "))
# Store all available servers:
# Name, URI, active
mirrors = []
if len(self.used_servers) < 1 or \
(len(self.used_servers) == 1 and \
- self.used_servers[0] == self.main_server):
+ compare_mirrors(self.used_servers[0], self.main_server)):
mirrors.append([_("Main server"), self.main_server, True])
mirrors.append([get_mirror_name(self.nearest_server),
self.nearest_server, False])
- elif len(self.used_servers) == 1 and not re.match(self.used_servers[0],
- self.main_server):
+ elif len(self.used_servers) == 1 and not \
+ compare_mirrors(self.used_servers[0], self.main_server):
mirrors.append([_("Main server"), self.main_server, False])
# Only one server is used
server = self.used_servers[0]
# Append the nearest server if it's not already used
- if not re.match(server, self.nearest_server):
+ if not compare_mirrors(server, self.nearest_server):
mirrors.append([get_mirror_name(self.nearest_server),
self.nearest_server, False])
mirrors.append([get_mirror_name(server), server, True])
@@ -408,7 +376,8 @@ class UbuntuDistribution(Distribution):
self.nearest_server, False])
mirrors.append([_("Custom servers"), None, True])
for server in self.used_servers:
- if re.match(server, self.nearest_server):
+ if compare_mirrors(server, self.nearest_server) or\
+ compare_mirrors(server, self.main_server):
continue
elif not [get_mirror_name(server), server, False] in mirrors:
mirrors.append([get_mirror_name(server), server, False])
diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py
index 754e2003..a10d5b68 100644
--- a/aptsources/sourceslist.py
+++ b/aptsources/sourceslist.py
@@ -32,11 +32,6 @@ import shutil
import time
import os.path
import sys
-#from gettext import gettext as _
-#import pdb
-
-import gettext
-def _(s): return gettext.dgettext("python-apt", s)
#from UpdateManager.Common.DistInfo import DistInfo
from distinfo import DistInfo
diff --git a/debian/changelog b/debian/changelog
index 280fc0cd..09f889f1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,13 @@
python-apt (0.6.20ubuntu15) feisty; urgency=low
+ [ Michael Vogt ]
* use the correct gettext domain
- -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 22 Mar 2007 15:55:54 +0100
+ [ Sebastian Heinlein ]
+ * remove an oboslete function
+ * fix the url comparision with trainling slashes - LP#95031
+
+ -- Sebastian Heinlein <sebi@sebi-laptop> Fri, 23 Mar 2007 14:48:55 +0100
python-apt (0.6.20ubuntu14) feisty; urgency=low