diff options
-rw-r--r-- | debian/control | 13 | ||||
-rwxr-xr-x | debian/rules | 2 | ||||
-rw-r--r-- | examples/plugin/repa_plugin/plugin.py | 4 | ||||
-rw-r--r-- | packaging/repa.spec | 18 | ||||
-rw-r--r-- | repa/common.py | 10 | ||||
-rw-r--r-- | repa/diff.py | 4 | ||||
-rwxr-xr-x | repa/group.py | 34 | ||||
-rwxr-xr-x | repa/list.py | 30 | ||||
-rw-r--r-- | repa/lock.py | 4 | ||||
-rwxr-xr-x | repa/main.py | 8 | ||||
-rw-r--r-- | repa/obs.py | 4 | ||||
-rw-r--r-- | repa/rebuild.py | 4 | ||||
-rw-r--r-- | repa/remove.py | 4 | ||||
-rw-r--r-- | repa/rmgroup.py | 2 | ||||
-rwxr-xr-x | repa/show.py | 44 | ||||
-rw-r--r-- | repa/unlock.py | 4 | ||||
-rw-r--r-- | repa/update.py | 4 |
17 files changed, 96 insertions, 97 deletions
diff --git a/debian/control b/debian/control index 99b9a41..5500fad 100644 --- a/debian/control +++ b/debian/control @@ -2,21 +2,20 @@ Source: repa Maintainer: Junghyun Kim <jh0822.kim@samsung.com> Section: utils Priority: optional -Build-Depends: debhelper (>= 9), - python-all (>= 2.6), - python-setuptools +Build-Depends: debhelper (>= 9), dh-python, + python3-all, python3, python3-setuptools Standards-Version: 3.8.4 XS-Python-Version: >= 2.6 Package: repa Architecture: all -Depends: python (>=2.6), +Depends: python3, osc, gbs-api, - python-setuptools, - python-jenkinsapi, + python3-setuptools, + python3-jenkinsapi, ${misc:Depends}, - ${python:Depends} + ${python3:Depends} Description: tool to help release engineers to maintain code submissions Release Engineering Process Assistant(REPA) is a tool for release engineers of Tizen projects. It allows to list submissions, accept or reject them and diff --git a/debian/rules b/debian/rules index 9c13336..641186e 100755 --- a/debian/rules +++ b/debian/rules @@ -1,4 +1,4 @@ #!/usr/bin/make -f %: - dh $@ --with=python2 + dh $@ --with python3 --buildsystem=pybuild diff --git a/examples/plugin/repa_plugin/plugin.py b/examples/plugin/repa_plugin/plugin.py index 602776b..7403fc0 100644 --- a/examples/plugin/repa_plugin/plugin.py +++ b/examples/plugin/repa_plugin/plugin.py @@ -47,8 +47,8 @@ class Test(object): def run(self, argv): """Command line entry point.""" - print '%s: Not implemented yet' % self.help - print 'paremeter: %s' % argv.opt + print('%s: Not implemented yet' % self.help) + print('paremeter: %s' % argv.opt) if __name__ == '__main__': diff --git a/packaging/repa.spec b/packaging/repa.spec index 63cf1e5..20ba448 100644 --- a/packaging/repa.spec +++ b/packaging/repa.spec @@ -12,13 +12,13 @@ Group: Development/Tools/Building Source0: %{name}_%{version}.tar.gz BuildArch: noarch -BuildRequires: python-setuptools +BuildRequires: python3-setuptools Requires: gbs-api Requires: osc -Requires: python >= 2.6 -Requires: python-setuptools -Requires: python-jenkinsapi +Requires: python3 +Requires: python3-setuptools +Requires: python3-jenkinsapi %description This tool is to assist release engineers to operate with submissions @@ -28,10 +28,10 @@ in easy and flexible manner %setup -q %build -%{__python} ./setup.py build +python3 ./setup.py build %install -%{__python} ./setup.py install --root=%{buildroot} --prefix=%{_prefix} +python3 ./setup.py install --root=%{buildroot} --prefix=%{_prefix} %clean rm -rf %{buildroot} @@ -41,9 +41,9 @@ rm -rf %{buildroot} %defattr(-,root,root,-) %config %{_sysconfdir}/%{name}.conf %{_datadir}/doc/packages/%{name} -%{python_sitelib}/%{name}-%{version}*.egg-info -%{python_sitelib}/%{name}-%{version}*-nspkg.pth -%{python_sitelib}/%{name} +%{python3_sitelib}/%{name}-%{version}*.egg-info +%{python3_sitelib}/%{name}-%{version}*-nspkg.pth +%{python3_sitelib}/%{name} %{_bindir}/%{name} %{_mandir}/man1/* diff --git a/repa/common.py b/repa/common.py index f9797bc..9f6c745 100644 --- a/repa/common.py +++ b/repa/common.py @@ -108,7 +108,7 @@ def accept_or_reject(obs, submission, state, target, comment='', for name, project, meta in _resolve_submissions(obs, submission, target): # osc submitreq [OPTIONS] SOURCEPRJ SOURCEPKG DESTPRJ [DESTPKG] # osc request accept [-m TEXT] ID - print "submission %s" % str(name) + print("submission %s" % str(name)) submitter = meta.get('submitter') projects = '[' + ', '.join(meta['projects']) + ']' @@ -128,8 +128,8 @@ def accept_or_reject(obs, submission, state, target, comment='', 'submission': str(name), 'target_project': target_prj, 'comment': comment}, jenkins_cred) - print "Jenkins job: re, build #%s, status: %s" % (build, status) - print out + print("Jenkins job: re, build #%s, status: %s" % (build, status)) + print(out) else: # Create SR org_source_packages=obs.get_source_packages(project) @@ -149,7 +149,7 @@ def accept_or_reject(obs, submission, state, target, comment='', reqid = obs.create_sr(project, source_packages, target_prj, message=message) - print 'created SR %s' % reqid + print('created SR %s' % reqid) # and immediately set its state message = "SR %s is set to %s" % (reqid, state) @@ -157,7 +157,7 @@ def accept_or_reject(obs, submission, state, target, comment='', message += comment obs.set_sr_state(reqid, state=state, message=str(message), force=True) - print 'set SR state to', state + print('set SR state to', state) # delete submit group if submission.startswith('submitgroup'): diff --git a/repa/diff.py b/repa/diff.py index 954321b..055c6a0 100644 --- a/repa/diff.py +++ b/repa/diff.py @@ -91,8 +91,8 @@ def diff(obs, cmpinfo, targetinfo, is_colorize=False): except RepaException: pass - print "%-55s %-12s %-12s %-40s %s" % \ - (path, rev_cmp[:10], str(rev_target)[:10], cmp_tag, status) + print("%-55s %-12s %-12s %-40s %s" % \ + (path, rev_cmp[:10], str(rev_target)[:10], cmp_tag, status)) class Diff(object): diff --git a/repa/group.py b/repa/group.py index 9f34f2d..23eb063 100755 --- a/repa/group.py +++ b/repa/group.py @@ -35,7 +35,7 @@ import json import re from collections import defaultdict -from StringIO import StringIO +from io import StringIO from multiprocessing.pool import ThreadPool from functools import partial @@ -47,18 +47,18 @@ from repa.common import RepaException, get_project_by_name, OBS_PROJECT_PREFIX def check_target_prj(submissions): """Check if target projects are the same for all submissions""" result = defaultdict(list) - for submission, data in submissions.iteritems(): + for submission, data in submissions.items(): result[data['meta']['obs_target_prj']].append(submission) if len(result) > 1: message = '\n'.join('%s: %s' % (project, ' '.join(subms)) \ - for project, subms in result.iteritems()) + for project, subms in result.items()) raise RepaException('Target projects differ:\n%s\n' % message) def check_build_results(bresults): """Check if build targets are published.""" for subm, _, results in bresults: - for target, res in results.iteritems(): + for target, res in results.items(): if res['state'] != 'published' or res['code'] != 'published': if res['packages']: raise RepaException("%s: target %s is not published yet" % @@ -75,21 +75,21 @@ def check_binary_pkgs(obs, submissions, noaggregate=''): """ binaries = defaultdict(dict) result = set(submissions.keys()) - for submission, data in sorted(submissions.iteritems()): + for submission, data in sorted(submissions.items()): pkgs = list(obs.get_binary_packages(data['project'])) # check if submission has binary packages for repo, bins in pkgs: # check if submissions have common packages - for subm, info in binaries.iteritems(): + for subm, info in binaries.items(): if repo in info: common = set(info[repo]).intersection(bins) if common and noaggregate: common = set(pkg for pkg in common \ if not re.match(noaggregate, pkg)) if common: - print '%s and %s have %d common packages,' \ + print('%s and %s have %d common packages,' \ ' skipping %s' % (subm, submission, - len(common), submission) + len(common), submission)) if submission in result: result.remove(submission) break @@ -129,7 +129,7 @@ def aggregate(obs, bresults, gproject, processes): if processes > 1: pool = ThreadPool(processes=processes) for subm, prj, results in bresults: - for res in results.itervalues(): + for res in results.values(): for pkg, state in res['packages']: if state == 'succeeded' and pkg not in aggregated: if processes > 1: @@ -139,7 +139,7 @@ def aggregate(obs, bresults, gproject, processes): callback=callback) else: obs.aggregate_package(prj, pkg, gproject, pkg) - print 'aggregated %s/%s' % (subm, pkg) + print('aggregated %s/%s' % (subm, pkg)) aggregated.add(pkg) if processes > 1: @@ -166,24 +166,24 @@ def group_submissions(obs, submissions, target, comment, check_target_prj(info) bresults = [(subm, data['project'], data['build_results']) \ - for subm, data in info.iteritems()] + for subm, data in info.items()] check_build_results(bresults) # filter out conflicting submissions filtered = check_binary_pkgs(obs, info, noaggregate) bresults = [item for item in bresults if item[0] in filtered] - info = dict(item for item in info.iteritems() if item[0] in filtered) + info = dict(item for item in info.items() if item[0] in filtered) # create group project - name, gproject = create_group_project(obs, info.keys(), - info.itervalues().next()['meta'], + name, gproject = create_group_project(obs, list(info.keys()), + iter(info.values()).next()['meta'], comment) - print 'Created submit group %s\n' % name + print('Created submit group %s\n' % name) aggregated = aggregate(obs, bresults, gproject, processes) - print '\n%d submissions (%d packages) have been merged into %s' % \ - (len(info), len(aggregated), name) + print('\n%d submissions (%d packages) have been merged into %s' % \ + (len(info), len(aggregated), name)) class Group(object): """Subcommand: Manage group submissions.""" diff --git a/repa/list.py b/repa/list.py index d92e4fa..d3f6372 100755 --- a/repa/list.py +++ b/repa/list.py @@ -44,7 +44,7 @@ def get_status(meta, colorizer, build_results=None, ignore='', if build_results: codes = set() pkgstatus = {} - for (repo, arch), target in build_results.iteritems(): + for (repo, arch), target in build_results.items(): codes.add(target.get('code')) codes.add(target.get('state')) for pkginfo in target['packages']: @@ -77,7 +77,7 @@ def get_status(meta, colorizer, build_results=None, ignore='', # Add build time to the status project = get_prerelease(meta['git_tag'], meta['obs_target_prj']) btime = 0 - for (repo, arch), target in build_results.iteritems(): + for (repo, arch), target in build_results.items(): btime = max(btime, obs.get_build_time(str(project), str(repo), str(arch))) minutes, seconds = divmod(btime, 60) @@ -91,11 +91,11 @@ def show_urls(meta): """Print OBS and download urls.""" download_url = get_download_url(meta) if download_url: - print ' download url: ', download_url + print(' download url: ', download_url) obs_url = get_obs_url(meta) if obs_url: - print ' obs url: ', obs_url - print + print(' obs url: ', obs_url) + print() def get_sr(obs, project, package, tag, status): """Check if tag is in comments of accepted/declined SRs.""" @@ -137,40 +137,40 @@ def list_submissions(obs, target, processes, base, is_colorize=False, if rsr: base_status = colorizer.red('rejected. SR %s' % rsr) if refprj: - print '%-37s %-37s %-37s %-37s %s' % \ + print('%-37s %-37s %-37s %-37s %s' % \ (meta['git_tag'], meta['ref_obs_target_prj'], get_status(meta, colorizer, build_results, ignore, obs, showtime), - base_status, ','.join(projects)) + base_status, ','.join(projects))) else: - print '%-37s %-37s %-37s %s' % \ + print('%-37s %-37s %-37s %s' % \ (meta['git_tag'], get_status(meta, colorizer, build_results, ignore, obs, showtime), - base_status, ','.join(projects)) + base_status, ','.join(projects))) else: if refprj: - print '%-37s %-37s %-37s %s' % \ + print('%-37s %-37s %-37s %s' % \ (meta['git_tag'], meta['ref_obs_target_prj'], get_status(meta, colorizer, build_results, ignore, obs, showtime), - ','.join(projects)) + ','.join(projects))) else: - print '%-37s %-37s %s' % \ + print('%-37s %-37s %s' % \ (meta['git_tag'], get_status(meta, colorizer, build_results, ignore, obs, showtime), - ','.join(projects)) + ','.join(projects))) if showurls: show_urls(meta) # groups if groups: - print + print() for meta in groups: - print '%-37s %-37s' % (meta['name'], get_status(meta, colorizer)) + print('%-37s %-37s' % (meta['name'], get_status(meta, colorizer))) if showurls: show_urls(meta) diff --git a/repa/lock.py b/repa/lock.py index a9d9c04..6f7af5d 100644 --- a/repa/lock.py +++ b/repa/lock.py @@ -66,8 +66,8 @@ class Lock(object): 'submission': argv.submission, 'target_project': argv.project, 'comment': argv.comment}, cred) - print "Jenkins job: %s, build #%s, status: %s" % (job, build, status) - print out + print("Jenkins job: %s, build #%s, status: %s" % (job, build, status)) + print(out) return status == 'SUCCESS' if __name__ == '__main__': diff --git a/repa/main.py b/repa/main.py index 68bfac8..bae9330 100755 --- a/repa/main.py +++ b/repa/main.py @@ -31,7 +31,7 @@ Command line parsing, script entry point. import sys import pkg_resources -import ConfigParser +import configparser from os.path import expanduser from argparse import ArgumentParser @@ -90,7 +90,7 @@ def read_config(paths=('/etc/repa.conf', expanduser('~/.repa.conf')), Configuration is read from the set of files provided. Optional section name can be specified to read options from """ - conf = ConfigParser.RawConfigParser() + conf = configparser.RawConfigParser() if not conf.read(paths): raise RepaException("Configuration file not found") if not conf.has_section(section): @@ -111,7 +111,7 @@ def read_config(paths=('/etc/repa.conf', expanduser('~/.repa.conf')), def update_args(config, args): """Set configuration options as args attributes.""" - for key, val in config.iteritems(): + for key, val in config.items(): if not hasattr(args, key): setattr(args, key, val) return args @@ -131,7 +131,7 @@ def main(argv=sys.argv[1:]): args = parse_args(argv) return args.func(args) except (RepaException, KeyboardInterrupt) as error: - print >> sys.stderr, error + print(error, file=sys.stderr) if __name__ == '__main__': diff --git a/repa/obs.py b/repa/obs.py index 1ac67e5..7e5c313 100644 --- a/repa/obs.py +++ b/repa/obs.py @@ -40,8 +40,8 @@ import locale from base64 import b64encode from xml.etree import cElementTree as ET -from StringIO import StringIO -from urllib2 import HTTPError +from io import StringIO +from urllib.error import HTTPError from osc import core diff --git a/repa/rebuild.py b/repa/rebuild.py index 898658f..7091022 100644 --- a/repa/rebuild.py +++ b/repa/rebuild.py @@ -68,8 +68,8 @@ class Rebuild(object): 'package': argv.package, 'target_project': argv.project, 'comment': argv.comment}, cred) - print "Jenkins job: %s, build #%s, status: %s" % (job, build, status) - print out + print("Jenkins job: %s, build #%s, status: %s" % (job, build, status)) + print(out) return status == 'SUCCESS' if __name__ == '__main__': diff --git a/repa/remove.py b/repa/remove.py index 5bfe05b..be21b89 100644 --- a/repa/remove.py +++ b/repa/remove.py @@ -66,8 +66,8 @@ class Remove(object): 'submission': argv.submission, 'target_project': argv.project, 'comment': argv.comment}, cred) - print "Jenkins job: %s, build #%s, status: %s" % (job, build, status) - print out + print("Jenkins job: %s, build #%s, status: %s" % (job, build, status)) + print(out) return status == 'SUCCESS' if __name__ == '__main__': diff --git a/repa/rmgroup.py b/repa/rmgroup.py index 8c3a901..97231ed 100644 --- a/repa/rmgroup.py +++ b/repa/rmgroup.py @@ -42,7 +42,7 @@ def rmgroup(obs, name, target): raise RepaException("Group name must start from 'submitgroup/'") project = get_project_by_name(obs, name, target)[0] obs.delete_project(project, force=True) - print 'Submission group %s has been removed' % name + print('Submission group %s has been removed' % name) class RmGroup(object): diff --git a/repa/show.py b/repa/show.py index bc479a4..a10b65f 100755 --- a/repa/show.py +++ b/repa/show.py @@ -42,7 +42,7 @@ def get_status(results): """Gest submission status.""" # Process project build results codes = set() - for target in results.itervalues(): + for target in results.values(): codes.add(target.get('code')) codes.add(target.get('state')) for pkginfo in target['packages']: @@ -56,51 +56,51 @@ def show(obs, name, target): is_group = name.startswith('submitgroup/') _, meta, build_results = get_project_by_name(obs, name, target) - print + print() if is_group: - print 'Submit Group:', name + print('Submit Group:', name) else: - print 'Submission:', name - print 'Target project:', target + print('Submission:', name) + print('Target project:', target) if 'git_commit' in meta: - print 'Commit:', meta['git_commit'] + print('Commit:', meta['git_commit']) if 'submitter' in meta: - print 'Submitter:', meta['submitter'] + print('Submitter:', meta['submitter']) download_url = get_download_url(meta) if download_url: - print 'Download Url:', download_url - print 'OBS Url:', get_obs_url(meta) + print('Download Url:', download_url) + print('OBS Url:', get_obs_url(meta)) if is_group: - print 'Submissions:' + print('Submissions:') for subm in meta['submissions']: - print ' ', subm + print(' ', subm) else: - print 'Git trees:' + print('Git trees:') for tree in meta['projects']: - print ' ', tree + print(' ', tree) if 'images' in meta: - print - print 'Images:' + print() + print('Images:') for img in meta['images']: - print ' %-40s %s' % (img['name'], img['status']) + print(' %-40s %s' % (img['name'], img['status'])) if build_results: result = defaultdict(list) - for (repo, arch), target in build_results.iteritems(): + for (repo, arch), target in build_results.items(): for pkg, status in target['packages']: if status not in ('succeeded', 'building', 'blocked', 'disabled'): result[(repo, arch)].append((pkg, status)) if result: - print - print 'Package build failures:' - for (repo, arch), pkginfo in result.iteritems(): + print() + print('Package build failures:') + for (repo, arch), pkginfo in result.items(): if pkginfo: - print ' %s/%s' % (repo, arch) + print(' %s/%s' % (repo, arch)) for pkg, status in pkginfo: - print ' %-40s %s' % (pkg, status) + print(' %-40s %s' % (pkg, status)) class Show(object): diff --git a/repa/unlock.py b/repa/unlock.py index 7e90330..de589e5 100644 --- a/repa/unlock.py +++ b/repa/unlock.py @@ -66,8 +66,8 @@ class Unlock(object): 'submission': argv.submission, 'target_project': argv.project, 'comment': argv.comment}, cred) - print "Jenkins job: %s, build #%s, status: %s" % (job, build, status) - print out + print("Jenkins job: %s, build #%s, status: %s" % (job, build, status)) + print(out) return status == 'SUCCESS' if __name__ == '__main__': diff --git a/repa/update.py b/repa/update.py index d9e3685..73ca372 100644 --- a/repa/update.py +++ b/repa/update.py @@ -65,8 +65,8 @@ def update(obs, name, target, ref_target_prj): prj, meta, build_results = get_project_by_name(obs, name, target) if meta['ref_obs_target_prj']: - print 'old_ref: %s new_ref: %s' %(meta['ref_obs_target_prj'], - ref_target_prj) + print('old_ref: %s new_ref: %s' %(meta['ref_obs_target_prj'], + ref_target_prj)) else: raise RepaException("update is not supported. " "ref_obs_target_prj values: %s" % \ |