From f03f0ec72ac5b96711a6db78da6b7e8f5c97e1ef Mon Sep 17 00:00:00 2001 From: Michael Bienia Date: Thu, 11 Jun 2009 20:36:11 +0200 Subject: [PATCH] * 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. --- buildd | 5 +---- ubuntutools/lp/functions.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/buildd b/buildd index b303240..79c3fba 100755 --- a/buildd +++ b/buildd @@ -27,6 +27,7 @@ from optparse import OptionGroup from optparse import OptionParser import ubuntutools.lp.udtexceptions from ubuntutools.lp.lpapiwrapper import LpApiWrapper +import ubuntutools.lp.functions as lp_functions # Usage. usage = "%prog \n\n" @@ -95,10 +96,6 @@ elif op in ("retry", "rescore") and options.architecture: else: 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 if '-' in release: (release, pocket) = release.split('-') diff --git a/ubuntutools/lp/functions.py b/ubuntutools/lp/functions.py index 60036c7..fd562ca 100644 --- a/ubuntutools/lp/functions.py +++ b/ubuntutools/lp/functions.py @@ -73,26 +73,30 @@ def _ubuntuSourcePackage(package, series, pocket = 'Release'): lpapiwrapper = LpApiWrapper() 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 development distroseries returns unicode string repr of source package version If the package does not exist: raise PackageNotFoundException """ + if not series: + series = LpApiWrapper.getUbuntuDevelopmentSeries() 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 returns unicode string representation of component If the package does not exist: raise PackageNotFoundException """ + if not series: + series = LpApiWrapper.getUbuntuDevelopmentSeries() 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 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 package does not exist: raise PackageNotFoundException """ + if not series: + series = LpApiWrapper.getUbuntuDevelopmentSeries() u_archive = LpApiWrapper.getUbuntuArchive()