From: Francois Gouget Date: Wed, 23 May 2012 12:54:43 +0000 (+0200) Subject: Avoid useless calls to guess_release_from_apt(). X-Git-Tag: archive/raspbian/10.2018112800+rpi1^2~113 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d7a416c697fc567d093e686777d45a21d6a6f6d4;p=lsb.git 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 --- 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'