mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-19 12:51:29 +00:00
* pull-lp-source: Use the new LpApiWrapper class.
This commit is contained in:
parent
d35077e14e
commit
5d9ef43b25
@ -33,8 +33,8 @@ import urllib2
|
|||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
# ubuntu-dev-tools modules.
|
# ubuntu-dev-tools modules.
|
||||||
import ubuntutools.lp.functions as lp_functions
|
from ubuntutools.lp.lpapiwrapper import LpApiWrapper
|
||||||
from ubuntutools import packages
|
from ubuntutools.lp.udtexceptions import SeriesNotFoundException, PackageNotFoundException
|
||||||
|
|
||||||
if not os.path.exists("/usr/bin/dget"):
|
if not os.path.exists("/usr/bin/dget"):
|
||||||
print "dget is not installed - please install the 'devscripts' package" \
|
print "dget is not installed - please install the 'devscripts' package" \
|
||||||
@ -64,8 +64,6 @@ class BackportFromLP:
|
|||||||
'Ensure that the package specified is a valid source ' +\
|
'Ensure that the package specified is a valid source ' +\
|
||||||
'package name and that Launchpad is not down.'
|
'package name and that Launchpad is not down.'
|
||||||
|
|
||||||
default_release = lp_functions.ubuntuDevelopmentSeries()
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
usage = "Usage: %prog <package> [release]"
|
usage = "Usage: %prog <package> [release]"
|
||||||
optParser = OptionParser(usage)
|
optParser = OptionParser(usage)
|
||||||
@ -78,14 +76,15 @@ if __name__ == '__main__':
|
|||||||
if len(args) == 2: # Custom distribution specified.
|
if len(args) == 2: # Custom distribution specified.
|
||||||
release = str(args[1]).lower()
|
release = str(args[1]).lower()
|
||||||
else:
|
else:
|
||||||
release = os.getenv('DIST') or default_release
|
release = os.getenv('DIST') or LpApiWrapper.getUbuntuDevelopmentSeries().name
|
||||||
|
|
||||||
# Arguments are correct, proceed.
|
# Arguments are correct, proceed.
|
||||||
# Check that the Ubuntu release specified exists.
|
# Check that the Ubuntu release and package specified exists.
|
||||||
lp_functions.doesUbuntuReleaseExist(release)
|
try:
|
||||||
|
LpApiWrapper.getUbuntuSourcePackage(package, release)
|
||||||
# Check package exists.
|
except (SeriesNotFoundException, PackageNotFoundException), e:
|
||||||
packages.checkSourceExists(package, release)
|
print e
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# All good - start downloading...
|
# All good - start downloading...
|
||||||
try:
|
try:
|
||||||
|
@ -43,19 +43,11 @@ def deprecated(func):
|
|||||||
# Singleton to access LP API
|
# Singleton to access LP API
|
||||||
launchpad = Launchpad
|
launchpad = Launchpad
|
||||||
|
|
||||||
@deprecated
|
|
||||||
def getUbuntuDistribution():
|
|
||||||
return LpApiWrapper.getUbuntuDistribution()
|
|
||||||
|
|
||||||
@deprecated
|
@deprecated
|
||||||
def ubuntuDevelopmentSeries():
|
def ubuntuDevelopmentSeries():
|
||||||
""" Get the string repr of the current Ubuntu development series """
|
""" Get the string repr of the current Ubuntu development series """
|
||||||
return LpApiWrapper.getUbuntuDevelopmentSeries().name
|
return LpApiWrapper.getUbuntuDevelopmentSeries().name
|
||||||
|
|
||||||
def doesUbuntuReleaseExist(name):
|
|
||||||
""" Prettier name to use for _ubuntuSeries() """
|
|
||||||
_ubuntuSeries(name)
|
|
||||||
|
|
||||||
def _ubuntuSeries(name):
|
def _ubuntuSeries(name):
|
||||||
""" Get the LP representation of a series
|
""" Get the LP representation of a series
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user