summaryrefslogtreecommitdiff
path: root/lsb_release.py
diff options
context:
space:
mode:
authorFrancois Gouget <fgouget@free.fr>2012-05-23 14:54:43 +0200
committerDidier Raboud <odyx@debian.org>2012-05-23 14:54:43 +0200
commitd7a416c697fc567d093e686777d45a21d6a6f6d4 (patch)
tree7a63fb2c8bf836e4d37580b0a3ae0998c7f48530 /lsb_release.py
parentcabfb66ce1cdc518d145dc79647e718b9515887d (diff)
Avoid useless calls to guess_release_from_apt().
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>
Diffstat (limited to 'lsb_release.py')
-rw-r--r--lsb_release.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lsb_release.py b/lsb_release.py
index 611737c..408c96b 100644
--- a/lsb_release.py
+++ b/lsb_release.py
@@ -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'