port python2.x code to python3.x 02/308402/1 accepted/tools_devbase_tools devel master accepted/tools/devbase/tools/20250527.103833 accepted/tools/devbase/tools/20250528.062309
authorbiao716.wang <biao716.wang@samsung.com>
Thu, 23 Mar 2023 03:22:57 +0000 (12:22 +0900)
committerxuhy <huayong.xu@samsung.com>
Mon, 25 Mar 2024 10:37:48 +0000 (18:37 +0800)
Change-Id: I10c5bcbe7330b9b7a645cf464726ecf1d25183c5
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
17 files changed:
debian/control
debian/rules
examples/plugin/repa_plugin/plugin.py
packaging/repa.spec
repa/common.py
repa/diff.py
repa/group.py
repa/list.py
repa/lock.py
repa/main.py
repa/obs.py
repa/rebuild.py
repa/remove.py
repa/rmgroup.py
repa/show.py
repa/unlock.py
repa/update.py

index 99b9a41f43df0171e251676a05daaf345aa2f61c..5500fad1807d54448ffa833d8a253f95d1b9c696 100644 (file)
@@ -2,21 +2,20 @@ Source: repa
 Maintainer: Junghyun Kim <jh0822.kim@samsung.com>
 Section: utils
 Priority: optional
 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
 Standards-Version: 3.8.4
 XS-Python-Version: >= 2.6
 
 Package: repa
 Architecture: all
-Depends: python (>=2.6),
+Depends: python3,
          osc,
          gbs-api,
          osc,
          gbs-api,
-         python-setuptools,
-         python-jenkinsapi,
+         python3-setuptools,
+         python3-jenkinsapi,
          ${misc:Depends},
          ${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
 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
index 9c13336902290dd8477ffa5c99deade3c78b36f6..641186e52d53d2f9909aad1be3c94f383b296efd 100755 (executable)
@@ -1,4 +1,4 @@
 #!/usr/bin/make -f
 
 %:
 #!/usr/bin/make -f
 
 %:
-       dh $@ --with=python2
+       dh $@ --with python3 --buildsystem=pybuild
index 602776ba79728646030981746fd13e5560cbdd45..7403fc0cc41ed33c0d1b77bdbebeebf3da0fec7c 100644 (file)
@@ -47,8 +47,8 @@ class Test(object):
 
     def run(self, argv):
         """Command line entry point."""
 
     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__':
 
 
 if __name__ == '__main__':
index 63cf1e51f2fae174ca91a8e2b4f5fe94e5705e61..20ba448f5acd9de929de5613cc32b67375bf1235 100644 (file)
@@ -12,13 +12,13 @@ Group:          Development/Tools/Building
 Source0:        %{name}_%{version}.tar.gz
 BuildArch:      noarch
 
 Source0:        %{name}_%{version}.tar.gz
 BuildArch:      noarch
 
-BuildRequires:  python-setuptools
+BuildRequires:  python3-setuptools
 
 Requires:       gbs-api
 Requires:       osc
 
 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
 
 %description
 This tool is to assist release engineers to operate with submissions
@@ -28,10 +28,10 @@ in easy and flexible manner
 %setup -q
 
 %build
 %setup -q
 
 %build
-%{__python} ./setup.py build
+python3 ./setup.py build
 
 %install
 
 %install
-%{__python} ./setup.py install --root=%{buildroot} --prefix=%{_prefix}
+python3 ./setup.py install --root=%{buildroot} --prefix=%{_prefix}
 
 %clean
 rm -rf %{buildroot}
 
 %clean
 rm -rf %{buildroot}
@@ -41,9 +41,9 @@ rm -rf %{buildroot}
 %defattr(-,root,root,-)
 %config %{_sysconfdir}/%{name}.conf
 %{_datadir}/doc/packages/%{name}
 %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/*
 
 %{_bindir}/%{name}
 %{_mandir}/man1/*
 
index f9797bcedb462815288db2c8110398d4b53c69ec..9f6c745885ad04d2262203aad4294eae8776fa19 100644 (file)
@@ -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
     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']) + ']'
 
         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)
                                      '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)
         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)
 
             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)
 
             # 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)
                 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'):
 
     # delete submit group
     if submission.startswith('submitgroup'):
index 954321b85e24dcb10c4d172e30b76f798914dce0..055c6a010192386c1e8c6cc9b3819379b3679fd2 100644 (file)
@@ -91,8 +91,8 @@ def diff(obs, cmpinfo, targetinfo, is_colorize=False):
                 except RepaException:
                     pass
 
                 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):
 
 
 class Diff(object):
index 9f34f2df1d9ed779be41617b17df57eeb92fe57d..23eb06324128e7ac56e3bdba813b84261e439f16 100755 (executable)
@@ -35,7 +35,7 @@ import json
 import re
 
 from collections import defaultdict
 import re
 
 from collections import defaultdict
-from StringIO import StringIO
+from io import StringIO
 from multiprocessing.pool import ThreadPool
 from functools import partial
 
 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)
 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)) \
         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:
         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" %
             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())
     """
     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
         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:
                 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,
                               ' skipping %s' % (subm, submission,
-                                                len(common), submission)
+                                                len(common), submission))
                         if submission in result:
                             result.remove(submission)
                         break
                         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:
     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:
             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)
                                          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:
                     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']) \
     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]
     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
 
     # 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)
                                           comment)
-    print 'Created submit group %s\n' % name
+    print('Created submit group %s\n' % name)
 
     aggregated = aggregate(obs, bresults, gproject, processes)
 
 
     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."""
 
 class Group(object):
     """Subcommand: Manage group  submissions."""
index d92e4fa8307c392ddcfdc03511d75b164233b41d..d3f63725e9604730b1220e4b5161fd73c6511c8e 100755 (executable)
@@ -44,7 +44,7 @@ def get_status(meta, colorizer, build_results=None, ignore='',
     if build_results:
         codes = set()
         pkgstatus = {}
     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']:
             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
         # 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)
             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 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:
     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."""
 
 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:
                     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),
                       (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:
             else:
-                print '%-37s %-37s %-37s %s' % \
+                print('%-37s %-37s %-37s %s' % \
                       (meta['git_tag'],
                        get_status(meta, colorizer, build_results,
                                   ignore, obs, showtime),
                       (meta['git_tag'],
                        get_status(meta, colorizer, build_results,
                                   ignore, obs, showtime),
-                       base_status, ','.join(projects))
+                       base_status, ','.join(projects)))
         else:
             if refprj:
         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),
                       (meta['git_tag'],
                        meta['ref_obs_target_prj'],
                        get_status(meta, colorizer, build_results,
                                   ignore, obs, showtime),
-                       ','.join(projects))
+                       ','.join(projects)))
             else:
             else:
-                 print '%-37s %-37s %s' % \
+                 print('%-37s %-37s %s' % \
                       (meta['git_tag'],
                        get_status(meta, colorizer, build_results,
                                   ignore, obs, showtime),
                       (meta['git_tag'],
                        get_status(meta, colorizer, build_results,
                                   ignore, obs, showtime),
-                       ','.join(projects))
+                       ','.join(projects)))
         if showurls:
             show_urls(meta)
 
     # groups
     if groups:
         if showurls:
             show_urls(meta)
 
     # groups
     if groups:
-        print
+        print()
         for meta in groups:
         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)
 
             if showurls:
                 show_urls(meta)
 
index a9d9c04d93acc3d8fc7a8d04955417b1ba776cf3..6f7af5dcf7223667a0e976df19673090b6354a69 100644 (file)
@@ -66,8 +66,8 @@ class Lock(object):
                                 'submission': argv.submission,
                                 'target_project': argv.project,
                                 'comment': argv.comment}, cred)
                                 '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__':
         return status == 'SUCCESS'
 
 if __name__ == '__main__':
index 68bfac839ac0fc42fe7ec90a7070368904fe428c..bae93307778151fb5adfe2ca492bf28e3c723812 100755 (executable)
@@ -31,7 +31,7 @@ Command line parsing, script entry point.
 
 import sys
 import pkg_resources
 
 import sys
 import pkg_resources
-import ConfigParser
+import configparser
 
 from os.path import expanduser
 from argparse import ArgumentParser
 
 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
     """
     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):
     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."""
 
 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
         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:
         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__':
 
 
 if __name__ == '__main__':
index 1ac67e5a4c14056d3adbd263174b7480981c09f7..7e5c31311a3e6ba856099b9dd490dc8c346ae7d4 100644 (file)
@@ -40,8 +40,8 @@ import locale
 
 from base64 import b64encode
 from xml.etree import cElementTree as ET
 
 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
 
 
 from osc import core
 
index 898658f16536255c6f642de803b2bcf96df60a18..709102257d7161bb45ae26844b1c5f41730de39e 100644 (file)
@@ -68,8 +68,8 @@ class Rebuild(object):
                                 'package': argv.package,
                                 'target_project': argv.project,
                                 'comment': argv.comment}, cred)
                                 '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__':
         return status == 'SUCCESS'
 
 if __name__ == '__main__':
index 5bfe05b00c27cf98f708cacdf74b2a7af4c278fa..be21b89fbb0fbd2ea3527374fc3db645571b219d 100644 (file)
@@ -66,8 +66,8 @@ class Remove(object):
                                 'submission': argv.submission,
                                 'target_project': argv.project,
                                 'comment': argv.comment}, cred)
                                 '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__':
         return status == 'SUCCESS'
 
 if __name__ == '__main__':
index 8c3a9014f341e2cee2dfb47dd123c2c22be1d820..97231edb69116963c322db8e4d325e3b93201ff0 100644 (file)
@@ -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)
         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):
 
 
 class RmGroup(object):
index bc479a4adf9a816fa2c6c231c6b976e70a142fbb..a10b65fe3954967df6fc39b46a5a287c88ae2a23 100755 (executable)
@@ -42,7 +42,7 @@ def get_status(results):
     """Gest submission status."""
     # Process project build results
     codes = set()
     """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']:
         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)
 
     is_group = name.startswith('submitgroup/')
     _, meta, build_results = get_project_by_name(obs, name, target)
 
-    print
+    print()
     if is_group:
     if is_group:
-        print 'Submit Group:', name
+        print('Submit Group:', name)
     else:
     else:
-        print 'Submission:', name
-    print 'Target project:', target
+        print('Submission:', name)
+    print('Target project:', target)
     if 'git_commit' in meta:
     if 'git_commit' in meta:
-        print 'Commit:', meta['git_commit']
+        print('Commit:', meta['git_commit'])
     if 'submitter' in meta:
     if 'submitter' in meta:
-        print 'Submitter:', meta['submitter']
+        print('Submitter:', meta['submitter'])
 
     download_url = get_download_url(meta)
     if download_url:
 
     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:
 
     if is_group:
-        print 'Submissions:'
+        print('Submissions:')
         for subm in meta['submissions']:
         for subm in meta['submissions']:
-            print '   ', subm
+            print('   ', subm)
     else:
     else:
-        print 'Git trees:'
+        print('Git trees:')
         for tree in meta['projects']:
         for tree in meta['projects']:
-            print '   ', tree
+            print('   ', tree)
     if 'images' in meta:
     if 'images' in meta:
-        print
-        print 'Images:'
+        print()
+        print('Images:')
         for img in meta['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)
 
     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:
             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:
                 if pkginfo:
-                    print '    %s/%s' % (repo, arch)
+                    print('    %s/%s' % (repo, arch))
                     for pkg, status in pkginfo:
                     for pkg, status in pkginfo:
-                        print '        %-40s %s' % (pkg, status)
+                        print('        %-40s %s' % (pkg, status))
 
 
 class Show(object):
 
 
 class Show(object):
index 7e9033070f01e9118787a6637b41724d4c59cf56..de589e54aeca2d7fdb2d35dddfcc243a8731a440 100644 (file)
@@ -66,8 +66,8 @@ class Unlock(object):
                                 'submission': argv.submission,
                                 'target_project': argv.project,
                                 'comment': argv.comment}, cred)
                                 '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__':
         return status == 'SUCCESS'
 
 if __name__ == '__main__':
index d9e36858842034391394668b2c432c1c68eac016..73ca3724731c6c63a3bcbe4105520b78093e3b26 100644 (file)
@@ -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']:
     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" % \
     else:
         raise RepaException("update is not supported. "
                                 "ref_obs_target_prj values: %s" % \