From d7a416c697fc567d093e686777d45a21d6a6f6d4 Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Wed, 23 May 2012 14:54:43 +0200 Subject: [PATCH] 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 --- lsb_release.py | 5 +++-- 1 file 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' -- 2.30.2