mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-07-03 19:11:28 +00:00
Port requestbackport to Python 3
This commit is contained in:
parent
0de4509da6
commit
7c0efe2914
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
#
|
#
|
||||||
# Copyright (C) 2011, Stefano Rivera <stefanor@ubuntu.com>
|
# Copyright (C) 2011, Stefano Rivera <stefanor@ubuntu.com>
|
||||||
#
|
#
|
||||||
@ -123,7 +123,7 @@ def find_rdepends(releases, published_binaries):
|
|||||||
except RDependsException:
|
except RDependsException:
|
||||||
# Not published? TODO: Check
|
# Not published? TODO: Check
|
||||||
continue
|
continue
|
||||||
for relationship, rdeps in raw_rdeps.iteritems():
|
for relationship, rdeps in raw_rdeps.items():
|
||||||
for rdep in rdeps:
|
for rdep in rdeps:
|
||||||
# Ignore circular deps:
|
# Ignore circular deps:
|
||||||
if rdep['Package'] in published_binaries:
|
if rdep['Package'] in published_binaries:
|
||||||
@ -134,14 +134,14 @@ def find_rdepends(releases, published_binaries):
|
|||||||
intermediate[binpkg][rdep['Package']].append((release, relationship))
|
intermediate[binpkg][rdep['Package']].append((release, relationship))
|
||||||
|
|
||||||
output = []
|
output = []
|
||||||
for binpkg, rdeps in intermediate.iteritems():
|
for binpkg, rdeps in intermediate.items():
|
||||||
output += ['', binpkg, '-' * len(binpkg)]
|
output += ['', binpkg, '-' * len(binpkg)]
|
||||||
for pkg, appearences in rdeps.iteritems():
|
for pkg, appearences in rdeps.items():
|
||||||
output += ['* %s' % pkg]
|
output += ['* %s' % pkg]
|
||||||
for release, relationship in appearences:
|
for release, relationship in appearences:
|
||||||
output += [' [ ] %s (%s)' % (release, relationship)]
|
output += [' [ ] %s (%s)' % (release, relationship)]
|
||||||
|
|
||||||
found_any = sum(len(rdeps) for rdeps in intermediate.itervalues())
|
found_any = sum(len(rdeps) for rdeps in intermediate.values())
|
||||||
if found_any:
|
if found_any:
|
||||||
output = [
|
output = [
|
||||||
"Reverse dependencies:",
|
"Reverse dependencies:",
|
||||||
@ -168,7 +168,7 @@ def locate_package(package, distribution):
|
|||||||
try:
|
try:
|
||||||
package_spph = archive.getSourcePackage(package, distribution)
|
package_spph = archive.getSourcePackage(package, distribution)
|
||||||
return package_spph
|
return package_spph
|
||||||
except PackageNotFoundException, e:
|
except PackageNotFoundException as e:
|
||||||
if pass_ == 'binary':
|
if pass_ == 'binary':
|
||||||
Logger.error(str(e))
|
Logger.error(str(e))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -292,7 +292,7 @@ def main():
|
|||||||
try:
|
try:
|
||||||
destinations = determine_destinations(options.source,
|
destinations = determine_destinations(options.source,
|
||||||
options.destination)
|
options.destination)
|
||||||
except DestinationException, e:
|
except DestinationException as e:
|
||||||
Logger.error(str(e))
|
Logger.error(str(e))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
2
setup.py
2
setup.py
@ -33,6 +33,7 @@ if sys.version_info[0] >= 3:
|
|||||||
'pull-lp-source',
|
'pull-lp-source',
|
||||||
'pull-revu-source',
|
'pull-revu-source',
|
||||||
'pull-uca-source',
|
'pull-uca-source',
|
||||||
|
'requestbackport',
|
||||||
'reverse-build-depends',
|
'reverse-build-depends',
|
||||||
'setup-packaging-environment',
|
'setup-packaging-environment',
|
||||||
]
|
]
|
||||||
@ -46,7 +47,6 @@ else:
|
|||||||
scripts = [
|
scripts = [
|
||||||
'import-bug-from-debian',
|
'import-bug-from-debian',
|
||||||
'merge-changelog',
|
'merge-changelog',
|
||||||
'requestbackport',
|
|
||||||
'requestsync',
|
'requestsync',
|
||||||
'reverse-depends',
|
'reverse-depends',
|
||||||
'seeded-in-ubuntu',
|
'seeded-in-ubuntu',
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import codecs
|
||||||
import tempfile
|
import tempfile
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@ -27,6 +28,7 @@ import ubuntutools.subprocess
|
|||||||
|
|
||||||
if sys.version_info[0] < 3:
|
if sys.version_info[0] < 3:
|
||||||
input = raw_input # noqa, pylint: disable=undefined-variable
|
input = raw_input # noqa, pylint: disable=undefined-variable
|
||||||
|
open = codecs.open
|
||||||
|
|
||||||
|
|
||||||
class Question(object):
|
class Question(object):
|
||||||
@ -133,7 +135,7 @@ class EditFile(object):
|
|||||||
def edit(self, optional=False):
|
def edit(self, optional=False):
|
||||||
if optional:
|
if optional:
|
||||||
print("\n\nCurrently the %s looks like:" % self.description)
|
print("\n\nCurrently the %s looks like:" % self.description)
|
||||||
with open(self.filename, 'r') as f:
|
with open(self.filename, 'r', encoding='utf-8') as f:
|
||||||
print(f.read())
|
print(f.read())
|
||||||
if YesNoQuestion().ask("Edit", "no") == "no":
|
if YesNoQuestion().ask("Edit", "no") == "no":
|
||||||
return
|
return
|
||||||
@ -146,7 +148,7 @@ class EditFile(object):
|
|||||||
modified = old_mtime != os.stat(self.filename).st_mtime
|
modified = old_mtime != os.stat(self.filename).st_mtime
|
||||||
placeholders_present = False
|
placeholders_present = False
|
||||||
if self.placeholders:
|
if self.placeholders:
|
||||||
with open(self.filename, 'r') as f:
|
with open(self.filename, 'r', encoding='utf-8') as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
for placeholder in self.placeholders:
|
for placeholder in self.placeholders:
|
||||||
if placeholder.search(line.strip()):
|
if placeholder.search(line.strip()):
|
||||||
@ -188,8 +190,8 @@ class EditBugReport(EditFile):
|
|||||||
placeholders)
|
placeholders)
|
||||||
|
|
||||||
def check_edit(self):
|
def check_edit(self):
|
||||||
with open(self.filename, 'r') as f:
|
with open(self.filename, 'r', encoding='utf-8') as f:
|
||||||
report = f.read().decode('utf-8')
|
report = f.read()
|
||||||
|
|
||||||
if self.split_re.match(report) is None:
|
if self.split_re.match(report) is None:
|
||||||
print("The %s doesn't start with 'Summary:' and 'Description:' "
|
print("The %s doesn't start with 'Summary:' and 'Description:' "
|
||||||
@ -199,8 +201,8 @@ class EditBugReport(EditFile):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def get_report(self):
|
def get_report(self):
|
||||||
with open(self.filename, 'r') as f:
|
with open(self.filename, 'r', encoding='utf-8') as f:
|
||||||
report = f.read().decode('utf-8')
|
report = f.read()
|
||||||
|
|
||||||
match = self.split_re.match(report)
|
match = self.split_re.match(report)
|
||||||
title = match.group(1).replace(u'\n', u' ')
|
title = match.group(1).replace(u'\n', u' ')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user