From 6edfde68719e461a8b08293ebadf400ffbc7fef7 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Wed, 8 Sep 2021 17:49:43 +0200 Subject: [PATCH] Python 3 support --- gerritclone/cmd.py | 12 ++++++------ tox.ini | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gerritclone/cmd.py b/gerritclone/cmd.py index 86f55a4..27f0eb0 100644 --- a/gerritclone/cmd.py +++ b/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. @@ -8,7 +8,7 @@ # import argparse -import ConfigParser +import configparser import logging import os import subprocess @@ -18,7 +18,6 @@ default_conf = { 'base_path': '~/projects', 'protocol': 'ssh', - 'user': None, 'port': 29418, 'path': '/', 'remotename': 'origin', @@ -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 += '@' @@ -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) @@ -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') @@ -194,5 +193,6 @@ def confreader(options): return dict(config.items(options.instance)) + if __name__ == '__main__': main() diff --git a/tox.ini b/tox.ini index a186380..1d06c9f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] minversion = 1.6 skipsdist = True -envlist = pep8, py27 +envlist = pep8, py3 [testenv] deps = nose