]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
setup: if invoking lsb_release doesn't work (which it doesn't on our etch buildslave...
authorZooko O'Whielacronx <zooko@zooko.com>
Tue, 23 Sep 2008 15:48:20 +0000 (08:48 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Tue, 23 Sep 2008 15:48:20 +0000 (08:48 -0700)
src/allmydata/__init__.py

index 45881b503471a82e4a2a45a928946c5298893add..ea5efb8ee115f3fe76326872625294bd695a2c6b 100644 (file)
@@ -36,9 +36,11 @@ def get_linux_distro():
 
     http://refspecs.freestandards.org/LSB_3.2.0/LSB-Core-generic/LSB-Core-generic/lsbrelease.html
 
-    If executing "lsb_release" raises no exception, and returns exit code 0,
-    then return a two-tuple containing the information that lsb_release emitted
-    as strings.
+    If executing "lsb_release" raises no exception, and returns exit code 0, and
+    both the "distributor id" and "release" results are non-empty after being
+    stripped of whitespace, then return a two-tuple containing the information
+    that lsb_release emitted, as strings.  Else, invoke platform.dist() and
+    return the first two elements of the tuple returned by that function.
 
     Returns a tuple (distname,version). Distname is what LSB calls a
     "distributor id", e.g. "Ubuntu".  Version is what LSB calls a "release",
@@ -68,7 +70,10 @@ def get_linux_distro():
     except EnvironmentError:
         pass
 
-    return (_distname, _version)
+    if _distname and _version:
+        return (_distname, _version)
+    else:
+        return platform.dist()[:2]
 
 def get_platform():
     # Our version of platform.platform(), telling us both less and more than the