summaryrefslogtreecommitdiff
path: root/gbp/scripts/create_remote_repo.py
diff options
context:
space:
mode:
Diffstat (limited to 'gbp/scripts/create_remote_repo.py')
-rwxr-xr-xgbp/scripts/create_remote_repo.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/gbp/scripts/create_remote_repo.py b/gbp/scripts/create_remote_repo.py
index a9832a1d..3b5aa764 100755
--- a/gbp/scripts/create_remote_repo.py
+++ b/gbp/scripts/create_remote_repo.py
@@ -18,10 +18,10 @@
# Based on the aa-create-git-repo and dom-new-git-repo shell scripts
"""Create a remote GIT repository based on the current one"""
-import ConfigParser
+import configparser
import sys
import os, os.path
-import urlparse
+import urllib.parse
import subprocess
import tty, termios
import re
@@ -51,22 +51,22 @@ 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"""
s = []
- for key in sorted(d.iterkeys()):
+ for key in sorted(d.keys()):
s.append((key, d[key]))
return s
@@ -103,7 +103,7 @@ def parse_url(remote_url, name, pkg, template_dir=None):
...
GbpError: URL contains invalid ~username expansion.
"""
- frags = urlparse.urlparse(remote_url)
+ frags = urllib.parse.urlparse(remote_url)
if frags.scheme in ['ssh', 'git+ssh', '']:
scheme = frags.scheme
else:
@@ -232,7 +232,7 @@ def build_parser(name, sections=[]):
usage='%prog [options] - '
'create a remote repository',
sections=sections)
- except ConfigParser.ParsingError as err:
+ except configparser.ParsingError as err:
gbp.log.err(err)
return None
@@ -306,7 +306,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 +350,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)