Skip to content

Commit

Permalink
Python 3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
hashar committed Sep 8, 2021
1 parent 27d2f4d commit 6edfde6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions gerritclone/cmd.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (c) 2013 Antoine Musso
# Copyright (c) Wikimedia Foundation Inc.
Expand All @@ -8,7 +8,7 @@
#

import argparse
import ConfigParser
import configparser
import logging
import os
import subprocess
Expand All @@ -18,7 +18,6 @@
default_conf = {
'base_path': '~/projects',
'protocol': 'ssh',
'user': None,
'port': 29418,
'path': '/',
'remotename': 'origin',
Expand All @@ -38,7 +37,7 @@ def main():
my_config['base_path'] = os.path.expanduser(my_config['base_path'])
logger.debug("Config: %s" % my_config)

# Fetch URL parts. Note that defaults are handled by ConfigParser
# Fetch URL parts. Note that defaults are handled by configparser
user_part = my_config.get('user')
if user_part:
user_part += '@'
Expand Down Expand Up @@ -73,7 +72,7 @@ def main():
cmd = ['git', 'clone', '-o', my_config.get('remotename'),
clone_url, dest_path]
if options.dry_run:
print "Git command:\n%s" % ' '.join(cmd)
print("Git command:\n%s" % ' '.join(cmd))
sys.exit(0)

logger.debug("Spawning: %s" % cmd)
Expand Down Expand Up @@ -170,7 +169,7 @@ def confreader(options):
logger = logging.getLogger(__name__)
logger.debug("Proceeding configuration")

config = ConfigParser.ConfigParser(default_conf)
config = configparser.ConfigParser(default_conf)

if not options.conf:
logger.info('No configuration file, using build-in defaults')
Expand All @@ -194,5 +193,6 @@ def confreader(options):

return dict(config.items(options.instance))


if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion tox.ini
@@ -1,7 +1,7 @@
[tox]
minversion = 1.6
skipsdist = True
envlist = pep8, py27
envlist = pep8, py3

[testenv]
deps = nose
Expand Down

0 comments on commit 6edfde6

Please sign in to comment.