tag 540208 + patch thanks Giovanni Mascellani ha scritto: > Maybe this could be improved: when there is more than one distribution > with maximum priority, it can return the most recent one (this make > sens, because it's the same algorithm used by APT when it falls back to > comparing versions). > > I'll try to write a patch tonight or tomorrow.
Ok, I'm attaching the patch I produced. Thanks, Giovanni. -- Giovanni Mascellani <[email protected]> Pisa, Italy Web: http://poisson.phc.unipi.it/~mascellani Jabber: [email protected] / [email protected]
diff -Nru lsb-3.2/lsb_release.py lsb-3.2/lsb_release.py
--- lsb-3.2/lsb_release.py 2009-07-21 10:54:43.000000000 +0200
+++ lsb-3.2/lsb_release.py 2010-04-18 23:06:09.000000000 +0200
@@ -40,6 +40,11 @@
TESTING_CODENAME = 'unknown.new.testing'
+RELEASES_ORDER = RELEASE_CODENAME_LOOKUP.items()
+RELEASES_ORDER.sort()
+RELEASES_ORDER = list(zip(*RELEASES_ORDER)[1])
+RELEASES_ORDER.extend(['stable', 'testing', 'unstable', 'sid'])
+
def lookup_codename(release, unknown=None):
m = re.match(r'(\d+)\.(\d+)(r(\d+))?', release)
if not m:
@@ -169,6 +174,10 @@
# We've sorted the list by descending priority, so the first entry should
# be the "main" release in use on the system
+ max_priority = releases[0][0]
+ releases = [x for x in releases if x[0] == max_priority]
+ releases.sort(cmp = lambda x,y: RELEASES_ORDER.index(y[1]['suite']) - RELEASES_ORDER.index(x[1]['suite']))
+
return releases[0][1]
def guess_debian_release():
signature.asc
Description: OpenPGP digital signature

