From 0a4725c045a5a55592dafd41c6ef6f9bab4791cd Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Thu, 19 Feb 2015 11:29:43 +0100 Subject: Don't use print as a statement via 2to3-3.4 -w -f print . to work towards python3 support Gbp-Dch: Ignore --- gbp/deb/changelog.py | 8 +++++--- gbp/scripts/create_remote_repo.py | 18 ++++++++++-------- gbp/scripts/dch.py | 10 ++++++---- gbp/scripts/import_dscs.py | 4 ++-- gbp/scripts/supercommand.py | 10 ++++++---- 5 files changed, 29 insertions(+), 21 deletions(-) (limited to 'gbp') diff --git a/gbp/deb/changelog.py b/gbp/deb/changelog.py index b3c56ef..631b5a6 100644 --- a/gbp/deb/changelog.py +++ b/gbp/deb/changelog.py @@ -16,6 +16,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """A Debian Changelog""" +from __future__ import print_function + import email import os import subprocess @@ -266,11 +268,11 @@ class ChangeLog(object): new_cl = open("debian/changelog.bak", "w") for line in old_cl: if line == " * [[[insert-git-dch-commit-message-here]]]\n": - print >> new_cl, " * " + msg[0] + print(" * " + msg[0], file=new_cl) for line in msg[1:]: - print >> new_cl, " " + line + print(" " + line, file=new_cl) else: - print >> new_cl, line, + print(line, file=new_cl) os.rename("debian/changelog.bak", "debian/changelog") def add_entry(self, msg, author=None, email=None, dch_options=[]): diff --git a/gbp/scripts/create_remote_repo.py b/gbp/scripts/create_remote_repo.py index b4d43c9..fd74dca 100644 --- a/gbp/scripts/create_remote_repo.py +++ b/gbp/scripts/create_remote_repo.py @@ -18,6 +18,8 @@ # Based on the aa-create-git-repo and dom-new-git-repo shell scripts """Create a remote Git repository based on the current one""" +from __future__ import print_function + import ConfigParser import sys import os, os.path @@ -51,17 +53,17 @@ def print_config(remote, branches): merge = refs/heads/bar """ - print """[remote "%(name)s"] + print("""[remote "%(name)s"] url = %(url)s - fetch = +refs/heads/*:refs/remotes/%(name)s/*""" % remote + fetch = +refs/heads/*:refs/remotes/%(name)s/*""" % remote) for branch in branches: - print " push = %s" % branch + print(" push = %s" % branch) for branch in branches: - print """[branch "%s"] + print("""[branch "%s"] remote = %s - merge = refs/heads/%s""" % (branch, remote['name'], branch) + merge = refs/heads/%s""" % (branch, remote['name'], branch)) def sort_dict(d): """Return a sorted list of (key, value) tuples""" @@ -306,7 +308,7 @@ def main(argv): try: options, args = parse_args(argv) except Exception as e: - print >>sys.stderr, "%s" % e + print("%s" % e, file=sys.stderr) return 1 gbp.log.setup(options.color, options.verbose, options.color_scheme) @@ -350,11 +352,11 @@ def main(argv): remote_script = build_remote_script(remote, branches[0]) if options.verbose: - print remote_script + print(remote_script) cmd = build_cmd(remote) if options.verbose: - print cmd + print(cmd) proc = subprocess.Popen(cmd, stdin=subprocess.PIPE) proc.communicate(remote_script) diff --git a/gbp/scripts/dch.py b/gbp/scripts/dch.py index e725bb1..b6c77b1 100644 --- a/gbp/scripts/dch.py +++ b/gbp/scripts/dch.py @@ -17,6 +17,8 @@ # """Generate Debian changelog entries from Git commit messages""" +from __future__ import print_function + import ConfigParser import os.path import re @@ -137,8 +139,8 @@ def mangle_changelog(changelog, cp, snapshot=''): cw = open(tmpfile, 'w') cr = open(changelog, 'r') - print >>cw, ("%(Source)s (%(MangledVersion)s) " - "%(Distribution)s; urgency=%(urgency)s\n" % cp) + print("%(Source)s (%(MangledVersion)s) " + "%(Distribution)s; urgency=%(urgency)s\n" % cp, file=cw) cr.readline() # skip version and empty line cr.readline() @@ -148,10 +150,10 @@ def mangle_changelog(changelog, cp, snapshot=''): line = '' if snapshot: - print >>cw, " ** SNAPSHOT build @%s **\n" % snapshot + print(" ** SNAPSHOT build @%s **\n" % snapshot, file=cw) if line: - print >>cw, line.rstrip() + print(line.rstrip(), file=cw) shutil.copyfileobj(cr, cw) cw.close() cr.close() diff --git a/gbp/scripts/import_dscs.py b/gbp/scripts/import_dscs.py index 9219ba0..440cec2 100644 --- a/gbp/scripts/import_dscs.py +++ b/gbp/scripts/import_dscs.py @@ -79,13 +79,13 @@ def set_gbp_conf_files(): gbp.log.debug("Setting GBP_CONF_FILES to '%s'" % gbp_conf_files) def print_help(): - print """Usage: gbp import-dscs [options] [gbp-import-dsc options] /path/to/dsc1 [/path/to/dsc2] ... + print("""Usage: gbp import-dscs [options] [gbp-import-dsc options] /path/to/dsc1 [/path/to/dsc2] ... gbp import-dscs --debsnap [options] [gbp-import-dsc options] package Options: --ignore-repo-config: ignore gbp.conf in git repo -""" +""") def main(argv): diff --git a/gbp/scripts/supercommand.py b/gbp/scripts/supercommand.py index 83c8446..a120ae5 100644 --- a/gbp/scripts/supercommand.py +++ b/gbp/scripts/supercommand.py @@ -17,6 +17,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """Supercommand for all gbp commands""" +from __future__ import print_function + import glob import os import re @@ -34,7 +36,7 @@ def sanitize(cmd): return cmd.replace('-', '_') def usage(): - print """ + print(""" Usage: gbp [] @@ -46,7 +48,7 @@ The most commonly used commands are: import-dscs - import multiple Debian source packages Use '--list-cmds' to list all available commands. -""" +""") def version(prog): try: @@ -125,10 +127,10 @@ def supercommand(argv=None): try: module = import_command(cmd) except ImportError as e: - print >>sys.stderr, "'%s' is not a valid command." % cmd + print("'%s' is not a valid command." % cmd, file=sys.stderr) usage() if '--verbose' in args: - print >>sys.stderr, e + print(e, file=sys.stderr) return 2 return module.main(args) -- cgit v1.2.3