diff --git a/jeepyb/cmd/manage_projects.py b/jeepyb/cmd/manage_projects.py index 52178ea..a05229c 100644 --- a/jeepyb/cmd/manage_projects.py +++ b/jeepyb/cmd/manage_projects.py @@ -45,6 +45,7 @@ # acl-parameters: # project: OTHER_PROJECT_NAME +from __future__ import print_function import ConfigParser import logging @@ -127,14 +128,14 @@ def fetch_config(project, remote_url, repo_path, env={}): status = git_command(repo_path, "fetch %s +refs/meta/config:" "refs/remotes/gerrit-meta/config" % remote_url, env) if status != 0: - print "Failed to fetch refs/meta/config for project: %s" % project + print("Failed to fetch refs/meta/config for project: %s" % project) return False # Because the following fails if executed more than once you should only # run fetch_config once in each repo. status = git_command(repo_path, "checkout -b config " "remotes/gerrit-meta/config") if status != 0: - print "Failed to checkout config for project: %s" % project + print("Failed to checkout config for project: %s" % project) return False return True @@ -158,14 +159,14 @@ def push_acl_config(project, remote_url, repo_path, gitid, env={}): cmd = "commit -a -m'Update project config.' --author='%s'" % gitid status = git_command(repo_path, cmd) if status != 0: - print "Failed to commit config for project: %s" % project + print("Failed to commit config for project: %s" % project) return False status, out = git_command_output(repo_path, "push %s HEAD:refs/meta/config" % remote_url, env) if status != 0: - print "Failed to push config for project: %s" % project - print out + print("Failed to push config for project: %s" % project) + print(out) return False return True @@ -212,7 +213,7 @@ def create_groups_file(project, gerrit, repo_path): fp.write("%s\t%s\n" % (uuid, group)) status = git_command(repo_path, "add groups") if status != 0: - print "Failed to add groups file for project: %s" % project + print("Failed to add groups file for project: %s" % project) return False return True @@ -224,7 +225,7 @@ def make_ssh_wrapper(gerrit_user, gerrit_key): 'ssh -i %s -l %s -o "StrictHostKeyChecking no" $@\n' % (gerrit_key, gerrit_user)) os.close(fd) - os.chmod(name, 0755) + os.chmod(name, 0o755) return dict(GIT_SSH=name) diff --git a/jeepyb/cmd/openstackwatch.py b/jeepyb/cmd/openstackwatch.py index 1515a6a..2381b4b 100644 --- a/jeepyb/cmd/openstackwatch.py +++ b/jeepyb/cmd/openstackwatch.py @@ -18,6 +18,9 @@ # for example hourly via cron. It takes an optional argument to specify the # path to a configuration file. # -*- encoding: utf-8 -*- + +from __future__ import print_function + __author__ = "Chmouel Boudjnah " import ConfigParser @@ -84,7 +87,7 @@ CONFIG = parse_ini(conffile) def debug(msg): if DEBUG: - print msg + print(msg) def get_javascript(project=None): @@ -110,7 +113,7 @@ def parse_javascript(javascript): def upload_rss(xml, output_object): if 'swift' not in CONFIG: - print xml + print(xml) return import swiftclient diff --git a/jeepyb/cmd/trivial_rebase.py b/jeepyb/cmd/trivial_rebase.py index b00191d..184ceb3 100644 --- a/jeepyb/cmd/trivial_rebase.py +++ b/jeepyb/cmd/trivial_rebase.py @@ -34,6 +34,8 @@ # Documentation is available here: # https://www.codeaurora.org/xwiki/bin/QAEP/Gerrit +from __future__ import print_function + import json import optparse import subprocess @@ -70,7 +72,7 @@ def CheckCall(command, cwd=None): try: process = subprocess.Popen(command, cwd=cwd, stdout=subprocess.PIPE) std_out, std_err = process.communicate() - except OSError, e: + except OSError as e: raise CheckCallError(command, cwd, e.errno, None) if process.returncode: raise CheckCallError(command, cwd, process.returncode, @@ -269,7 +271,7 @@ def main(): # Similarly squash old approvals continue else: - print "Unsupported category: %s" % approval + print("Unsupported category: %s" % approval) sys.exit(0) score = approval["value"] diff --git a/test-requirements.txt b/test-requirements.txt index 8b2c2da..974f05f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1 +1 @@ -hacking>=0.5.3,<0.6 +hacking>=0.5.6,<0.7