diff options
author | Guido Günther <agx@sigxcpu.org> | 2015-02-19 11:29:43 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2015-02-20 12:39:00 +0100 |
commit | 0a4725c045a5a55592dafd41c6ef6f9bab4791cd (patch) | |
tree | ca9f3e8bea00d455e8f8b2c21bba947adc16b976 | |
parent | f7afe1d06c56748c6d9bfcae6166beba21bb3e53 (diff) |
Don't use print as a statement
via
2to3-3.4 -w -f print .
to work towards python3 support
Gbp-Dch: Ignore
-rwxr-xr-x | examples/zeitgeist-git.py | 2 | ||||
-rw-r--r-- | gbp/deb/changelog.py | 8 | ||||
-rw-r--r-- | gbp/scripts/create_remote_repo.py | 18 | ||||
-rw-r--r-- | gbp/scripts/dch.py | 10 | ||||
-rw-r--r-- | gbp/scripts/import_dscs.py | 4 | ||||
-rw-r--r-- | gbp/scripts/supercommand.py | 10 | ||||
-rw-r--r-- | tests/09_test_write_tree.py | 4 |
7 files changed, 33 insertions, 23 deletions
diff --git a/examples/zeitgeist-git.py b/examples/zeitgeist-git.py index 4edd946..33114cd 100755 --- a/examples/zeitgeist-git.py +++ b/examples/zeitgeist-git.py @@ -48,7 +48,7 @@ else: try: CLIENT = ZeitgeistClient() except RuntimeError as e: - print "Unable to connect to Zeitgeist, won't send events. Reason: '%s'" %e + print("Unable to connect to Zeitgeist, won't send events. Reason: '%s'" %e) def get_repo(): 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 <command> [<args>] @@ -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) diff --git a/tests/09_test_write_tree.py b/tests/09_test_write_tree.py index 7147da5..314d76f 100644 --- a/tests/09_test_write_tree.py +++ b/tests/09_test_write_tree.py @@ -2,6 +2,8 @@ """Test L{GitRepository}'s write_tree method""" +from __future__ import print_function + from . import context import os @@ -20,7 +22,7 @@ class TestWriteTree(testutils.DebianGitTestRepo): for i in range(4): path = os.path.join(self.repo.path, 'testfile%d' % i) with open(path, 'w') as f: - print >>f, "testdata %d" % i + print("testdata %d" % i, file=f) paths.append(path) return paths |