mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-12 17:31:29 +00:00
backportpackage: Run lsb_release as command if the Python module is not available
This commit is contained in:
parent
05af489f64
commit
a3c87e78aa
@ -27,7 +27,10 @@ import sys
|
|||||||
import tempfile
|
import tempfile
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
|
|
||||||
import lsb_release
|
try:
|
||||||
|
import lsb_release
|
||||||
|
except ImportError:
|
||||||
|
lsb_release = None
|
||||||
from httplib2 import Http, HttpLib2Error
|
from httplib2 import Http, HttpLib2Error
|
||||||
from distro_info import DebianDistroInfo, UbuntuDistroInfo
|
from distro_info import DebianDistroInfo, UbuntuDistroInfo
|
||||||
|
|
||||||
@ -396,11 +399,17 @@ def main(args):
|
|||||||
Launchpad.login_anonymously(service=opts.lpinstance)
|
Launchpad.login_anonymously(service=opts.lpinstance)
|
||||||
|
|
||||||
if not opts.dest_releases:
|
if not opts.dest_releases:
|
||||||
distinfo = lsb_release.get_distro_information()
|
if lsb_release:
|
||||||
try:
|
distinfo = lsb_release.get_distro_information()
|
||||||
current_distro = distinfo['ID']
|
try:
|
||||||
except KeyError:
|
current_distro = distinfo['ID']
|
||||||
error('No destination release specified and unable to guess yours.')
|
except KeyError:
|
||||||
|
error('No destination release specified and unable to guess yours.')
|
||||||
|
else:
|
||||||
|
err, current_distro = subprocess.getstatusoutput('lsb_release --id --short')
|
||||||
|
if err:
|
||||||
|
error('Could not run lsb_release to retrieve distribution')
|
||||||
|
|
||||||
if current_distro == "Ubuntu":
|
if current_distro == "Ubuntu":
|
||||||
opts.dest_releases = [UbuntuDistroInfo().lts()]
|
opts.dest_releases = [UbuntuDistroInfo().lts()]
|
||||||
if current_distro == "Debian":
|
if current_distro == "Debian":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user