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():
# 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
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=[]):
# 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
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"""
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)
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)
#
"""Generate Debian changelog entries from Git commit messages"""
+from __future__ import print_function
+
import ConfigParser
import os.path
import re
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()
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()
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):
# 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
return cmd.replace('-', '_')
def usage():
- print """
+ print("""
Usage:
gbp <command> [<args>]
import-dscs - import multiple Debian source packages
Use '--list-cmds' to list all available commands.
-"""
+""")
def version(prog):
try:
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)
"""Test L{GitRepository}'s write_tree method"""
+from __future__ import print_function
+
from . import context
import os
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