# HG changeset patch # User Raphaël Gomès <rgomes@octobus.net> # Date 1571818366 -7200 # Wed Oct 23 10:12:46 2019 +0200 # Node ID ba4c5deb6c2bcd36357c730336a4a5b39651ed07 # Parent 307b9c16fa781fed5c74e4f459904d540ee2c1e4 py3: move print statements to the print function diff --git a/create_stripped_cached_repos.py b/create_stripped_cached_repos.py --- a/create_stripped_cached_repos.py +++ b/create_stripped_cached_repos.py @@ -1,5 +1,6 @@ """ Ensure that all repository are cloned and at their tip """ +from __future__ import print_function import errno import os import subprocess @@ -18,7 +19,7 @@ raise for repo_name, repo in config["repos"].items(): clonedir = join(repos_dir, repo_name) - print partial_revset + print(partial_revset) for pset, setconfig in partial_revset.items(): revset = setconfig.get('remove') repo_suffix = urllib.quote_plus(revset) diff --git a/scheduler.py b/scheduler.py --- a/scheduler.py +++ b/scheduler.py @@ -13,6 +13,7 @@ can edit this file, please use an editor that detects when the tasks file changed since you start editing it (at least nano does it). """ +from __future__ import print_function import re import os import argparse diff --git a/script/setup-repos b/script/setup-repos --- a/script/setup-repos +++ b/script/setup-repos @@ -2,6 +2,8 @@ # # Script to setup the reference repository used for benchmarl +from __future__ import print_function + DEFAULT_REPO_SOURCE = "https://static.octobus.net/asv/" import hashlib @@ -40,18 +42,18 @@ Repository will be fetch from `source` and setup in `repodir` """ - print "Setting up reference repository: %s" % repo + print("Setting up reference repository: %s" % repo) # setup one # download reference # extract partial from `.benchrepo` # setup partial # download partial # hg update the reference - print ' main reference' + print(' main reference') setup_repo_variant(repodir, source, repo, None, update=True) refpath = join(repodir, repo + '.benchrepo') if not os.path.exists(refpath): - print ' missing data file' + print(' missing data file') setup_repo_variant(repodir, source, repo, None, update=True, force=True) refdata = read_yaml(refpath) partial_sets = refdata.get("partial-sets") @@ -60,7 +62,7 @@ raise SetupError(msg) for variant in sorted(partial_sets): - print ' partial reference: ', variant + print(' partial reference: ', variant) setup_repo_variant(repodir, source, repo, variant) def repobasename(repo_name, partial_id): @@ -152,14 +154,14 @@ repo_path = repopath(repo_dir, repo_name, partial_id) setup_file = setupfile(repo_path) if os.path.exists(setup_file) and not force: - print ' already up to date' + print(' already up to date') return if os.path.exists(repo_path): shutil.rmtree(repo_path) - print ' downloading repo' + print(' downloading repo') download_repo(repo_dir, source, repo_name, partial_id) if update: - print ' updating repo' + print(' updating repo') update_repo(repo_path) conclude_setup(repo_path) @@ -177,12 +179,12 @@ if __name__ == "__main__": if not (2 <= len(sys.argv) <= 4): - print >> sys.stderr, "usage: %s REPOS-FILE [DIRECTORY [SOURCE]]" - print >> sys.stderr, "" - print >> sys.stderr, "Make sure all item in REPOS-FILE are setup in DIRECTORY." - print >> sys.stderr, "(default `.`)." - print >> sys.stderr, "When missing, data are fetched from SOURCE" - print >> sys.stderr, "(default: %s)" % DEFAULT_REPO_SOURCE + print("usage: %s REPOS-FILE [DIRECTORY [SOURCE]]", file=sys.stderr) + print("", file=sys.stderr) + print("Make sure all item in REPOS-FILE are setup in DIRECTORY.", file=sys.stderr) + print("(default `.`).", file=sys.stderr) + print("When missing, data are fetched from SOURCE", file=sys.stderr) + print("(default: %s)" % DEFAULT_REPO_SOURCE, file=sys.stderr) sys.exit(128) reposfile = sys.argv[1] @@ -203,6 +205,6 @@ try: setup_all_repos(repo_dir, source, repos) except SetupError as exc: - print >> sys.stderr, 'abort:', str(exc) + print('abort:', str(exc), file=sys.stderr) sys.exit(1) sys.exit(0)