This commit is contained in:
Dimitri John Ledkov 2014-12-18 20:56:13 +00:00
parent c8ec463f7a
commit 8c6371a416

View File

@ -15,6 +15,11 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
from __future__ import print_function
if sys.version_info[0] < 3:
range = xrange
import os import os
import pwd import pwd
import shutil import shutil
@ -81,11 +86,11 @@ def edit_source():
# Spawn shell to allow modifications # Spawn shell to allow modifications
cmd = [get_user_shell()] cmd = [get_user_shell()]
Logger.command(cmd) Logger.command(cmd)
print """An interactive shell was launched in print("""An interactive shell was launched in
file://%s file://%s
Edit your files. When you are done, exit the shell. If you wish to abort the Edit your files. When you are done, exit the shell. If you wish to abort the
process, exit the shell such that it returns an exit code other than zero. process, exit the shell such that it returns an exit code other than zero.
""" % (os.getcwd()), """ % (os.getcwd()), end=' ')
returncode = subprocess.call(cmd) returncode = subprocess.call(cmd)
if returncode != 0: if returncode != 0:
Logger.error("Shell exited with exit value %i." % (returncode)) Logger.error("Shell exited with exit value %i." % (returncode))
@ -113,10 +118,10 @@ def ask_for_patch_or_branch(bug, attached_patches, linked_branches):
i = 0 i = 0
for linked_branch in linked_branches: for linked_branch in linked_branches:
i += 1 i += 1
print "%i) %s" % (i, linked_branch.display_name) print("%i) %s" % (i, linked_branch.display_name))
for attached_patch in attached_patches: for attached_patch in attached_patches:
i += 1 i += 1
print "%i) %s" % (i, attached_patch.title) print("%i) %s" % (i, attached_patch.title))
selected = input_number("Which branch or patch do you want to download", selected = input_number("Which branch or patch do you want to download",
1, i, i) 1, i, i)
if selected <= len(linked_branches): if selected <= len(linked_branches):
@ -220,9 +225,9 @@ def get_open_ubuntu_bug_task(launchpad, bug, branch=None):
else: else:
Logger.normal("https://launchpad.net/bugs/%i has %i Ubuntu tasks:" \ Logger.normal("https://launchpad.net/bugs/%i has %i Ubuntu tasks:" \
% (bug_id, len(ubuntu_tasks))) % (bug_id, len(ubuntu_tasks)))
for i in xrange(len(ubuntu_tasks)): for i in range(len(ubuntu_tasks)):
print "%i) %s" % (i + 1, print("%i) %s" % (i + 1,
ubuntu_tasks[i].get_package_and_series()) ubuntu_tasks[i].get_package_and_series()))
selected = input_number("To which Ubuntu task does the patch belong", selected = input_number("To which Ubuntu task does the patch belong",
1, len(ubuntu_tasks)) 1, len(ubuntu_tasks))
task = ubuntu_tasks[selected - 1] task = ubuntu_tasks[selected - 1]
@ -235,7 +240,7 @@ def _create_and_change_into(workdir):
if not os.path.isdir(workdir): if not os.path.isdir(workdir):
try: try:
os.makedirs(workdir) os.makedirs(workdir)
except os.error, error: except os.error as error:
Logger.error("Failed to create the working directory %s [Errno " \ Logger.error("Failed to create the working directory %s [Errno " \
"%i]: %s." % (workdir, error.errno, error.strerror)) "%i]: %s." % (workdir, error.errno, error.strerror))
sys.exit(1) sys.exit(1)
@ -248,7 +253,7 @@ def _update_maintainer_field():
Logger.command(["update-maintainer"]) Logger.command(["update-maintainer"])
try: try:
update_maintainer("debian", Logger.verbose) update_maintainer("debian", Logger.verbose)
except MaintainerUpdateException, e: except MaintainerUpdateException as e:
Logger.error("update-maintainer failed: %s", str(e)) Logger.error("update-maintainer failed: %s", str(e))
sys.exit(1) sys.exit(1)