summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2015-02-21 16:12:09 +0100
committerGuido Günther <agx@sigxcpu.org>2015-03-27 12:10:55 +0100
commit0a4198a732e870c12006ed5b03cf16c5cc8bde23 (patch)
tree7ca855ad0ec2488f5f0bfe6392691afd19bc308a
parenta33276d8da726d7e60908884cb404e56ec907064 (diff)
Fix print function usage in examples too
-rwxr-xr-xexamples/gbp-add-patch8
-rwxr-xr-xexamples/gbp-posttag-push15
-rw-r--r--gbp/rpm/linkedlist.py2
3 files changed, 14 insertions, 11 deletions
diff --git a/examples/gbp-add-patch b/examples/gbp-add-patch
index 62d35ce..b635bb7 100755
--- a/examples/gbp-add-patch
+++ b/examples/gbp-add-patch
@@ -1,7 +1,7 @@
#!/usr/bin/python -u
# vim: set fileencoding=utf-8 :
#
-# (C) 2010 Guido Guenther <agx@sigxcpu.org>
+# (C) 2010,2015 Guido Guenther <agx@sigxcpu.org>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@@ -31,6 +31,7 @@ commits debian/patches/0010-bla-fasel with this changelog message:
Closes: <bugs>
Thanks: <author>
"""
+from __future__ import print_function
import re
import sys
@@ -85,7 +86,8 @@ def main(argv):
try:
repo = GitRepository(os.path.curdir)
except GitRepositoryError:
- print >>sys.stderr, "%s is not a git repository" % (os.path.abspath('.'))
+ print("%s is not a git repository" % os.path.abspath('.'),
+ file=sys.stderr)
return 1
try:
@@ -106,7 +108,7 @@ def main(argv):
retval = 1
except GbpError as err:
if str(err):
- print >>sys.stderr, err
+ print(err, file=sys.stderr)
retval = 1
return retval
diff --git a/examples/gbp-posttag-push b/examples/gbp-posttag-push
index cabffff..a178e04 100755
--- a/examples/gbp-posttag-push
+++ b/examples/gbp-posttag-push
@@ -1,7 +1,7 @@
#!/usr/bin/python
# vim: set fileencoding=utf-8 :
#
-# (C) 2009,2012 Guido Guenther <agx@sigxcpu.org>
+# (C) 2009,2012,2015 Guido Guenther <agx@sigxcpu.org>
#
# gbp-posttag-push: post tag hook to be called by git-buildpackage to push out
# the newly created tag and to forward the remote branch to that position
@@ -19,6 +19,7 @@
# -u: push upstream branch too, if not on remote already
# --verbose: verbose command output
+from __future__ import print_function
from six.moves import configparser
import os
@@ -62,7 +63,7 @@ def get_pull(env):
def git_push_sim(*args):
- print "git push %s" % " ".join(args)
+ print("git push %s" % " ".join(args))
def get_upstream_tag(repo, tag, tag_format):
@@ -106,7 +107,7 @@ def main(argv):
repo = DebianGitRepository('.')
if options.dryrun:
- print "Dry run mode. Not pushing."
+ print("Dry run mode. Not pushing.")
repo.push = git_push_sim
repo.push_tag = git_push_sim
@@ -115,7 +116,7 @@ def main(argv):
if var:
env.__dict__.setdefault( "%s" % envvar.split("_")[1].lower(), var)
else:
- print >>sys.stderr, "%s not set." % envvar
+ print("%s not set." % envvar, file=sys.stderr)
return 1
dests = get_push_targets(env)
@@ -127,11 +128,11 @@ def main(argv):
upstream_sha1 = repo.rev_parse("%s^{}" % upstream_tag)
if not repo.verify_tag(env.tag):
- print >>sys.stderr, "Not pushing unsigned tag $GBP_TAG."
+ print("Not pushing unsigned tag $GBP_TAG.", file=sys.stderr)
return 0
for dest in dests:
- print "Pushing %s to %s" % (env.sha1, dest)
+ print("Pushing %s to %s" % (env.sha1, dest))
repo.push_tag(dest, env.tag)
repo.push(dest, env.sha1, dests[dest])
if options.push_upstream and upstream_tag:
@@ -139,7 +140,7 @@ def main(argv):
if not repo.branch_contains("%s/%s" % (dest, options.upstream_branch),
upstream_sha1, remote=True):
repo.push(dest, upstream_sha1, options.upstream_branch)
- print "done."
+ print("done.")
if __name__ == '__main__':
sys.exit(main(sys.argv))
diff --git a/gbp/rpm/linkedlist.py b/gbp/rpm/linkedlist.py
index 74d897b..bc1df4c 100644
--- a/gbp/rpm/linkedlist.py
+++ b/gbp/rpm/linkedlist.py
@@ -193,7 +193,7 @@ class LinkedList(collections.Iterable):
'foo'
>>> [str(data) for data in list]
['foo', 'bar']
- >>> print "%s" % node3
+ >>> print("%s" % node3)
<BLANKLINE>
>>> str(list.delete(node1))
'bar'