mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-06-18 11:41:28 +00:00
Port pull-lp-source to Python 3
This commit is contained in:
parent
6a60ee963d
commit
4239d49582
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
#
|
#
|
||||||
# pull-lp-source -- pull a source package from Launchpad
|
# pull-lp-source -- pull a source package from Launchpad
|
||||||
# Basic usage: pull-lp-source <source package> [<release>]
|
# Basic usage: pull-lp-source <source package> [<release>]
|
||||||
@ -26,7 +26,8 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import urllib2
|
import urllib.error
|
||||||
|
import urllib.request
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
from distro_info import UbuntuDistroInfo, DistroDataOutdated
|
from distro_info import UbuntuDistroInfo, DistroDataOutdated
|
||||||
@ -49,11 +50,11 @@ def source_package_for(binary, release):
|
|||||||
% (release, binary))
|
% (release, binary))
|
||||||
data = None
|
data = None
|
||||||
try:
|
try:
|
||||||
data = json.load(urllib2.urlopen(url))['r']
|
data = json.load(urllib.request.urlopen(url))['r']
|
||||||
except urllib2.URLError, e:
|
except urllib.error.URLError as e:
|
||||||
Logger.error('Unable to retrieve package information from DDE: '
|
Logger.error('Unable to retrieve package information from DDE: '
|
||||||
'%s (%s)', url, str(e))
|
'%s (%s)', url, str(e))
|
||||||
except ValueError, e:
|
except ValueError as e:
|
||||||
Logger.error('Unable to parse JSON response from DDE: '
|
Logger.error('Unable to parse JSON response from DDE: '
|
||||||
'%s (%s)', url, str(e))
|
'%s (%s)', url, str(e))
|
||||||
if not data:
|
if not data:
|
||||||
@ -94,7 +95,7 @@ def main():
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
version = os.getenv('DIST') or ubuntu_info.devel()
|
version = os.getenv('DIST') or ubuntu_info.devel()
|
||||||
except DistroDataOutdated, e:
|
except DistroDataOutdated as e:
|
||||||
Logger.warn("%s\nOr specify a distribution.", e)
|
Logger.warn("%s\nOr specify a distribution.", e)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
component = None
|
component = None
|
||||||
@ -104,16 +105,16 @@ def main():
|
|||||||
pocket = None
|
pocket = None
|
||||||
try:
|
try:
|
||||||
(release, pocket) = split_release_pocket(version, default=None)
|
(release, pocket) = split_release_pocket(version, default=None)
|
||||||
except PocketDoesNotExistError, e:
|
except PocketDoesNotExistError as e:
|
||||||
pass
|
pass
|
||||||
if release in ubuntu_info.all:
|
if release in ubuntu_info.all:
|
||||||
archive = Distribution('ubuntu').getArchive()
|
archive = Distribution('ubuntu').getArchive()
|
||||||
try:
|
try:
|
||||||
spph = archive.getSourcePackage(package, release, pocket)
|
spph = archive.getSourcePackage(package, release, pocket)
|
||||||
except SeriesNotFoundException, e:
|
except SeriesNotFoundException as e:
|
||||||
Logger.error(str(e))
|
Logger.error(str(e))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
except PackageNotFoundException, e:
|
except PackageNotFoundException as e:
|
||||||
source_package = source_package_for(package, release)
|
source_package = source_package_for(package, release)
|
||||||
if source_package is not None and source_package != package:
|
if source_package is not None and source_package != package:
|
||||||
try:
|
try:
|
||||||
@ -135,7 +136,7 @@ def main():
|
|||||||
mirrors=[options.ubuntu_mirror])
|
mirrors=[options.ubuntu_mirror])
|
||||||
try:
|
try:
|
||||||
srcpkg.pull()
|
srcpkg.pull()
|
||||||
except DownloadError, e:
|
except DownloadError as e:
|
||||||
Logger.error('Failed to download: %s', str(e))
|
Logger.error('Failed to download: %s', str(e))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if not options.download_only:
|
if not options.download_only:
|
||||||
|
2
setup.py
2
setup.py
@ -30,6 +30,7 @@ if sys.version_info[0] >= 3:
|
|||||||
'pbuilder-dist-simple',
|
'pbuilder-dist-simple',
|
||||||
'pull-debian-debdiff',
|
'pull-debian-debdiff',
|
||||||
'pull-debian-source',
|
'pull-debian-source',
|
||||||
|
'pull-lp-source',
|
||||||
'pull-revu-source',
|
'pull-revu-source',
|
||||||
'reverse-build-depends',
|
'reverse-build-depends',
|
||||||
'setup-packaging-environment',
|
'setup-packaging-environment',
|
||||||
@ -44,7 +45,6 @@ else:
|
|||||||
scripts = [
|
scripts = [
|
||||||
'import-bug-from-debian',
|
'import-bug-from-debian',
|
||||||
'merge-changelog',
|
'merge-changelog',
|
||||||
'pull-lp-source',
|
|
||||||
'pull-uca-source',
|
'pull-uca-source',
|
||||||
'requestbackport',
|
'requestbackport',
|
||||||
'requestsync',
|
'requestsync',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user