mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-19 12:51:29 +00:00
Replace LpApiWrapper.getUbuntuDistribution() with Distribution('ubuntu')
This commit is contained in:
parent
74e55c2166
commit
a49e4f6d43
6
buildd
6
buildd
@ -27,7 +27,7 @@ import sys
|
|||||||
from optparse import OptionGroup
|
from optparse import OptionGroup
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from ubuntutools.lp.udtexceptions import SeriesNotFoundException, PackageNotFoundException
|
from ubuntutools.lp.udtexceptions import SeriesNotFoundException, PackageNotFoundException
|
||||||
from ubuntutools.lp.lpapicache import LpApiWrapper, PersonTeam
|
from ubuntutools.lp.lpapicache import Distribution, PersonTeam
|
||||||
|
|
||||||
# Usage.
|
# Usage.
|
||||||
usage = "%prog <srcpackage> <release> <operation>\n\n"
|
usage = "%prog <srcpackage> <release> <operation>\n\n"
|
||||||
@ -124,7 +124,7 @@ if not options.batch:
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Get the ubuntu archive
|
# Get the ubuntu archive
|
||||||
ubuntu_archive = LpApiWrapper.getUbuntuDistribution().getArchive()
|
ubuntu_archive = Distribution('ubuntu').getArchive()
|
||||||
# Get list of published sources for package in question.
|
# Get list of published sources for package in question.
|
||||||
try:
|
try:
|
||||||
sources = ubuntu_archive.getSourcePackage(package, release, pocket)
|
sources = ubuntu_archive.getSourcePackage(package, release, pocket)
|
||||||
@ -210,7 +210,7 @@ if release and '-' in release:
|
|||||||
print 'Unknown pocket: %s' % pocket
|
print 'Unknown pocket: %s' % pocket
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
ubuntu_archive = LpApiWrapper.getUbuntuDistribution().getArchive()
|
ubuntu_archive = Distribution('ubuntu').getArchive()
|
||||||
me = PersonTeam.getMe()
|
me = PersonTeam.getMe()
|
||||||
|
|
||||||
# Check permisions (part 1): Rescoring can only be done by buildd admins
|
# Check permisions (part 1): Rescoring can only be done by buildd admins
|
||||||
|
@ -33,7 +33,7 @@ import urllib2
|
|||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
# ubuntu-dev-tools modules.
|
# ubuntu-dev-tools modules.
|
||||||
from ubuntutools.lp.lpapicache import LpApiWrapper
|
from ubuntutools.lp.lpapicache import LpApiWrapper, Distribution
|
||||||
from ubuntutools.lp.udtexceptions import SeriesNotFoundException, PackageNotFoundException
|
from ubuntutools.lp.udtexceptions import SeriesNotFoundException, PackageNotFoundException
|
||||||
|
|
||||||
if not os.path.exists("/usr/bin/dget"):
|
if not os.path.exists("/usr/bin/dget"):
|
||||||
@ -76,7 +76,7 @@ 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 LpApiWrapper.getUbuntuDistribution().getDevelopmentSeries().name
|
release = os.getenv('DIST') or Distribution('ubuntu').getDevelopmentSeries().name
|
||||||
|
|
||||||
# Arguments are correct, proceed.
|
# Arguments are correct, proceed.
|
||||||
# Check that the Ubuntu release and package specified exists.
|
# Check that the Ubuntu release and package specified exists.
|
||||||
|
@ -38,7 +38,7 @@ from time import sleep
|
|||||||
# ubuntu-dev-tools modules.
|
# ubuntu-dev-tools modules.
|
||||||
import ubuntutools.lp.libsupport as lp_libsupport
|
import ubuntutools.lp.libsupport as lp_libsupport
|
||||||
import ubuntutools.lp.udtexceptions as udtexceptions
|
import ubuntutools.lp.udtexceptions as udtexceptions
|
||||||
from ubuntutools.lp.lpapicache import Launchpad, LpApiWrapper, PersonTeam
|
from ubuntutools.lp.lpapicache import Launchpad, LpApiWrapper, Distribution, PersonTeam
|
||||||
# https_proxy fix
|
# https_proxy fix
|
||||||
import ubuntutools.common
|
import ubuntutools.common
|
||||||
import ubuntutools.packages
|
import ubuntutools.packages
|
||||||
@ -95,7 +95,7 @@ def checkExistingReports(package):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# Fetch the package's bug list from Launchpad.
|
# Fetch the package's bug list from Launchpad.
|
||||||
pkg = LpApiWrapper.getUbuntuDistribution().getSourcePackage(name=package)
|
pkg = Distribution('ubuntu').getSourcePackage(name=package)
|
||||||
pkgBugList = pkg.searchTasks()
|
pkgBugList = pkg.searchTasks()
|
||||||
|
|
||||||
# Search bug list for other sync requests.
|
# Search bug list for other sync requests.
|
||||||
@ -474,7 +474,7 @@ if __name__ == '__main__':
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if len(args) not in (2, 3): # no release specified, assume development release
|
if len(args) not in (2, 3): # no release specified, assume development release
|
||||||
release = LpApiWrapper.getUbuntuDistribution().getDevelopmentSeries().name
|
release = Distribution('ubuntu').getDevelopmentSeries().name
|
||||||
print >> sys.stderr, ("Source package / target release missing - assuming %s " %
|
print >> sys.stderr, ("Source package / target release missing - assuming %s " %
|
||||||
release)
|
release)
|
||||||
else:
|
else:
|
||||||
|
@ -58,13 +58,6 @@ class LpApiWrapper(object):
|
|||||||
ubuntu-dev-tools.
|
ubuntu-dev-tools.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def getUbuntuDistribution(cls):
|
|
||||||
'''
|
|
||||||
Returns a Distibution object for Ubuntu.
|
|
||||||
'''
|
|
||||||
return Distribution('ubuntu')
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getUbuntuSourcePackage(cls, name, series, pocket = 'Release'):
|
def getUbuntuSourcePackage(cls, name, series, pocket = 'Release'):
|
||||||
'''
|
'''
|
||||||
@ -73,7 +66,7 @@ class LpApiWrapper(object):
|
|||||||
Returns a wrapped LP representation of the source package.
|
Returns a wrapped LP representation of the source package.
|
||||||
If the package does not exist: raise PackageNotFoundException
|
If the package does not exist: raise PackageNotFoundException
|
||||||
'''
|
'''
|
||||||
return cls.getUbuntuDistribution().getArchive().getSourcePackage(name, series, pocket)
|
return Distribution('ubuntu').getArchive().getSourcePackage(name, series, pocket)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def canUploadPackage(cls, srcpkg, series = None):
|
def canUploadPackage(cls, srcpkg, series = None):
|
||||||
@ -87,14 +80,14 @@ class LpApiWrapper(object):
|
|||||||
assume 'universe' for component.
|
assume 'universe' for component.
|
||||||
'''
|
'''
|
||||||
component = 'universe'
|
component = 'universe'
|
||||||
archive = cls.getUbuntuDistribution().getArchive()
|
archive = Distribution('ubuntu').getArchive()
|
||||||
|
|
||||||
if isinstance(srcpkg, SourcePackage):
|
if isinstance(srcpkg, SourcePackage):
|
||||||
package = srcpkg.getPackageName()
|
package = srcpkg.getPackageName()
|
||||||
component = srcpkg.getComponent()
|
component = srcpkg.getComponent()
|
||||||
else:
|
else:
|
||||||
if not series:
|
if not series:
|
||||||
series = cls.getUbuntuDistribution().getDevelopmentSeries()
|
series = Distribution('ubuntu').getDevelopmentSeries()
|
||||||
try:
|
try:
|
||||||
srcpkg = archive.getSourcePackage(srcpkg, series)
|
srcpkg = archive.getSourcePackage(srcpkg, series)
|
||||||
package = srcpkg.getPackageName()
|
package = srcpkg.getPackageName()
|
||||||
@ -113,7 +106,7 @@ class LpApiWrapper(object):
|
|||||||
if isinstance(package, SourcePackage):
|
if isinstance(package, SourcePackage):
|
||||||
package = package.getPackageName()
|
package = package.getPackageName()
|
||||||
|
|
||||||
archive = cls.getUbuntuDistribution().getArchive()
|
archive = Distribution('ubuntu').getArchive()
|
||||||
|
|
||||||
return PersonTeam.getMe().canUploadPackage(archive, package, None)
|
return PersonTeam.getMe().canUploadPackage(archive, package, None)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user