diff --git a/backportpackage b/backportpackage index 320486b..13a7a5e 100755 --- a/backportpackage +++ b/backportpackage @@ -27,7 +27,10 @@ import sys import tempfile from urllib.parse import quote -import lsb_release +try: + import lsb_release +except ImportError: + lsb_release = None from httplib2 import Http, HttpLib2Error from distro_info import DebianDistroInfo, UbuntuDistroInfo @@ -396,11 +399,17 @@ def main(args): Launchpad.login_anonymously(service=opts.lpinstance) if not opts.dest_releases: - distinfo = lsb_release.get_distro_information() - try: - current_distro = distinfo['ID'] - except KeyError: - error('No destination release specified and unable to guess yours.') + if lsb_release: + distinfo = lsb_release.get_distro_information() + try: + current_distro = distinfo['ID'] + 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": opts.dest_releases = [UbuntuDistroInfo().lts()] if current_distro == "Debian":