lib/oe/lsb.py: Map unknown distributions to 'Unknown'
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 31 Jul 2012 07:01:28 +0000 (08:01 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 31 Jul 2012 07:02:11 +0000 (08:02 +0100)
(From OE-Core rev: e12df2ca5c71ad672ebbfefbc47cabbac3333d61)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/lsb.py

index 36dd12f..c8852a2 100644 (file)
@@ -5,7 +5,7 @@ def release_dict():
     try:
         output, err = bb.process.run(['lsb_release', '-a'], stderr=PIPE)
     except bb.process.CmdError as exc:
-        return
+        return None
 
     data = {}
     for line in output.splitlines():
@@ -22,7 +22,13 @@ def distro_identifier(adjust_hook=None):
        with optional adjustment via a hook"""
 
     lsb_data = release_dict()
-    distro_id, release = lsb_data['Distributor ID'], lsb_data['Release']
+    if lsb_data:
+        distro_id, release = lsb_data['Distributor ID'], lsb_data['Release']
+    else:
+        distro_id, release = None, None
+        
     if adjust_hook:
         distro_id, release = adjust_hook(distro_id, release)
+    if not distro_id:
+        return "Unknown"
     return '{0}-{1}'.format(distro_id, release).replace(' ','-')