Avoid useless calls to guess_release_from_apt().
authorFrancois Gouget <fgouget@free.fr>
Wed, 23 May 2012 12:54:43 +0000 (14:54 +0200)
committerDidier Raboud <odyx@debian.org>
Wed, 23 May 2012 12:54:43 +0000 (14:54 +0200)
In guess_debian_release(), avoid calling guess_release_from_apt() if a
codename is already provided.

Closes: #674143
Signed-off-by: Didier Raboud <odyx@debian.org>
lsb_release.py

index 611737ca7f2c336a2a83f815b526137e17cc7e1f..408c96b3a0f4eabed06ff1125515d9b0338ea4f6 100644 (file)
@@ -271,8 +271,9 @@ def guess_debian_release():
     # This is slightly faster and less error prone in case the user
     # has an entry in his /etc/apt/sources.list but has not actually
     # upgraded the system.
-    rinfo = guess_release_from_apt()
-    if rinfo and not distinfo.get('CODENAME'):
+    if not distinfo.get('CODENAME'):
+      rinfo = guess_release_from_apt()
+      if rinfo:
         release = rinfo.get('version')
 
         # Special case Debian-Ports as their Release file has 'version': '1.0'