mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-13 09:51:30 +00:00
* ubuntutools/lp/functions.py: Make the default values of the function not use
a value fetched from LP. Instead fetch the default value during call time. This way the functions module doesn't require to use LP API during module load. * buildd: Move the import of ubuntutools.lp.functions to the other module inclusion.
This commit is contained in:
parent
edce828ee0
commit
f03f0ec72a
5
buildd
5
buildd
@ -27,6 +27,7 @@ from optparse import OptionGroup
|
|||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import ubuntutools.lp.udtexceptions
|
import ubuntutools.lp.udtexceptions
|
||||||
from ubuntutools.lp.lpapiwrapper import LpApiWrapper
|
from ubuntutools.lp.lpapiwrapper import LpApiWrapper
|
||||||
|
import ubuntutools.lp.functions as lp_functions
|
||||||
|
|
||||||
# Usage.
|
# Usage.
|
||||||
usage = "%prog <srcpackage> <release> <operation>\n\n"
|
usage = "%prog <srcpackage> <release> <operation>\n\n"
|
||||||
@ -95,10 +96,6 @@ elif op in ("retry", "rescore") and options.architecture:
|
|||||||
else:
|
else:
|
||||||
oneArch = False
|
oneArch = False
|
||||||
|
|
||||||
# ubuntu-dev-tools modules
|
|
||||||
# Import here to improve speed perception parsing options for user.
|
|
||||||
import ubuntutools.lp.functions as lp_functions
|
|
||||||
|
|
||||||
# split release and pocket
|
# split release and pocket
|
||||||
if '-' in release:
|
if '-' in release:
|
||||||
(release, pocket) = release.split('-')
|
(release, pocket) = release.split('-')
|
||||||
|
@ -73,26 +73,30 @@ def _ubuntuSourcePackage(package, series, pocket = 'Release'):
|
|||||||
lpapiwrapper = LpApiWrapper()
|
lpapiwrapper = LpApiWrapper()
|
||||||
return lpapiwrapper.getUbuntuSourcePackage(package, series, pocket)
|
return lpapiwrapper.getUbuntuSourcePackage(package, series, pocket)
|
||||||
|
|
||||||
def packageVersion(package, series=ubuntuDevelopmentSeries()):
|
def packageVersion(package, series=None):
|
||||||
""" Retrieves the version of a given source package in the current
|
""" Retrieves the version of a given source package in the current
|
||||||
development distroseries
|
development distroseries
|
||||||
|
|
||||||
returns unicode string repr of source package version
|
returns unicode string repr of source package version
|
||||||
If the package does not exist: raise PackageNotFoundException
|
If the package does not exist: raise PackageNotFoundException
|
||||||
"""
|
"""
|
||||||
|
if not series:
|
||||||
|
series = LpApiWrapper.getUbuntuDevelopmentSeries()
|
||||||
|
|
||||||
return _ubuntuSourcePackage(package, series).source_package_version
|
return _ubuntuSourcePackage(package, series).source_package_version
|
||||||
|
|
||||||
def packageComponent(package, series=ubuntuDevelopmentSeries()):
|
def packageComponent(package, series=None):
|
||||||
""" Retrieves the component for a given source package
|
""" Retrieves the component for a given source package
|
||||||
|
|
||||||
returns unicode string representation of component
|
returns unicode string representation of component
|
||||||
If the package does not exist: raise PackageNotFoundException
|
If the package does not exist: raise PackageNotFoundException
|
||||||
"""
|
"""
|
||||||
|
if not series:
|
||||||
|
series = LpApiWrapper.getUbuntuDevelopmentSeries()
|
||||||
|
|
||||||
return _ubuntuSourcePackage(package, series).component_name
|
return _ubuntuSourcePackage(package, series).component_name
|
||||||
|
|
||||||
def canUploadPackage(package, series=ubuntuDevelopmentSeries()):
|
def canUploadPackage(package, series=None):
|
||||||
""" Checks whether the user can upload package to Ubuntu's main archive
|
""" Checks whether the user can upload package to Ubuntu's main archive
|
||||||
|
|
||||||
Uses LP API to do this.
|
Uses LP API to do this.
|
||||||
@ -101,6 +105,8 @@ def canUploadPackage(package, series=ubuntuDevelopmentSeries()):
|
|||||||
If the user cannot upload the package: return False.
|
If the user cannot upload the package: return False.
|
||||||
If the package does not exist: raise PackageNotFoundException
|
If the package does not exist: raise PackageNotFoundException
|
||||||
"""
|
"""
|
||||||
|
if not series:
|
||||||
|
series = LpApiWrapper.getUbuntuDevelopmentSeries()
|
||||||
|
|
||||||
u_archive = LpApiWrapper.getUbuntuArchive()
|
u_archive = LpApiWrapper.getUbuntuArchive()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user