port code from python2.x to python3.x 09/283809/8
authorbiao716.wang <biao716.wang@samsung.com>
Thu, 3 Nov 2022 07:55:32 +0000 (16:55 +0900)
committerbiao716.wang <biao716.wang@samsung.com>
Tue, 8 Nov 2022 13:26:20 +0000 (22:26 +0900)
Change-Id: Iebed78d34b8d8355068123f09bede0e24be1aafd
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
27 files changed:
bsr/bsr/__version__.py
bsr/bsr/analyzer/data_analyzer.py
bsr/bsr/gbs/gbs_actions.py
bsr/bsr/network/dep_parse.py
bsr/bsr/report/depends_xml.py
bsr/bsr/utility/monitoring.py
bsr/bsr/utility/utils.py
bsr/setup.py
debian/control
debian/rules
gitbuildsys/cmd_build.py
gitbuildsys/cmd_depends.py
gitbuildsys/cmd_devel.py
gitbuildsys/cmd_export.py
gitbuildsys/cmd_remotebuild.py
gitbuildsys/conf.py
gitbuildsys/oscapi.py
gitbuildsys/parsing.py
gitbuildsys/safe_url.py
gitbuildsys/utils.py
packaging/gbs.spec
setup.py
tests/test_config.py
tests/test_help.py
tests/test_passwdx.py
tests/test_profile.py
tools/gbs

index 6c9ad8f4565c67420e1a18620fdf222d40e1356a..064e1f4bc9abbae36b455bb41efe17d987ba1fbf 100644 (file)
@@ -9,4 +9,4 @@ __author__ = 'Hyokeun Jeon'
 __author_email__ = 'hyokeun.jeon@samsung.com'
 __license__ = 'Apache 2.0'
 __copyright__ = 'Copyright 2020 Samsung Research'
-__cake__ = u'\u2728 \U0001f370 \u2728'
+__cake__ = '\u2728 \U0001f370 \u2728'
index 33ade9c33ad4e91d973e598a040adc6cfa3c0485..5801c47860c2b291347767a78cf12b4e29fb2db2 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #
 # Copyright (c) 2021 Samsung Electronics.Co.Ltd.
@@ -124,7 +124,7 @@ class DataAnalyzer:
             for package in self.topology_sorted[level]:
                 for dep in self.edges[package]:
                     count_link[package][dep] = 1
-                    zipped = zip(count_link[package], count_link[dep])
+                    zipped = list(zip(count_link[package], count_link[dep]))
                     count_link[package] = list(starmap(or_, zipped))
 
         self.count_link_map = count_link
@@ -190,7 +190,7 @@ class DataAnalyzer:
                     console('{} does not exists in the top order'.format(package), verbose=True)
 
         # [[pkg1, 39], [pkg2, 21], [pkg2, 7], ...]
-        top_links_order = sorted(top_links_order.items(), key=lambda x: x[1], reverse=True)
+        top_links_order = sorted(list(top_links_order.items()), key=lambda x: x[1], reverse=True)
 
         console('Total #{} items...'.format(len(top_links_order)), verbose=self.verbose)
 
index 38d5ec780bd2c3ab091bab5186890abbb6e7bd27..471fd8c1415e423cef57e177f585145bdce94174 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #
 # Copyright (c) 2021 Samsung Electronics.Co.Ltd.
@@ -19,7 +19,7 @@ import subprocess
 import shutil
 
 try:
-    from ConfigParser import SafeConfigParser
+    from configparser import SafeConfigParser
 except ImportError:
     from configparser import SafeConfigParser
 
index 49a36a9ad66576c096f61b8378024635175cac51..8d943a508490aab5fcf30f78787a89bdf1e483ba 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #
 # Copyright (c) 2021 Samsung Electronics.Co.Ltd.
@@ -91,7 +91,7 @@ def make_edges(nodes, sorted_info, dep_packages, cycle_edges, reduced_info):
                         edges.add(short_item)
         level = level + 1
 
-    for src_pkg, dst_pkgs in cycle_edges.items():
+    for src_pkg, dst_pkgs in list(cycle_edges.items()):
         for dst_pkg in dst_pkgs:
             if src_pkg in nodes and dst_pkg in nodes:
                 edges.add((src_pkg, dst_pkg, 'true'))
@@ -110,7 +110,7 @@ def make_full_edges(nodes, dep_packages, cycle_edges):
                 if dst_pkg in nodes:
                     edges.add((pkg, dst_pkg, 'false'))
 
-    for src_pkg, dst_pkgs in cycle_edges.items():
+    for src_pkg, dst_pkgs in list(cycle_edges.items()):
         for dst_pkg in dst_pkgs:
             if src_pkg in nodes and dst_pkg in nodes:
                 edges.add((src_pkg, dst_pkg, 'true'))
@@ -154,7 +154,7 @@ def topology_sort_package(nodes, dep_packages, in_edge_count, cycle_edges, reduc
 
     # compensate nodes.
     # if a node is in cycle_edges, insert it into the nodes.
-    for src, dst_pkgs in cycle_edges.items():
+    for src, dst_pkgs in list(cycle_edges.items()):
         if src not in nodes:
             continue
         for dst_pkg in dst_pkgs:
@@ -183,7 +183,7 @@ def find_main_package_name(sub_pkg_name, share_var):
 
     # If it is a main package, we cannot find it in sub_main_pkg.
     # In this case, just return the package name
-    if sub_pkg_name in share_var.main_sub_pkg.keys():
+    if sub_pkg_name in list(share_var.main_sub_pkg.keys()):
         return sub_pkg_name
 
     if not sub_pkg_name in share_var.sub_main_pkg:
@@ -200,8 +200,8 @@ def insert_sub_package(pkg_name, sub_pkg_name, share_var):
     share_var.main_sub_pkg[pkg_name].append(sub_pkg_name)
 
     if sub_pkg_name in share_var.sub_main_pkg:
-        print('Subpackage ' + sub_pkg_name + ' is related to one or more main ' + 'packages(' \
-              + share_var.sub_main_pkg[sub_pkg_name] + ',' + pkg_name + ')!\n')
+        print(('Subpackage ' + sub_pkg_name + ' is related to one or more main ' + 'packages(' \
+              + share_var.sub_main_pkg[sub_pkg_name] + ',' + pkg_name + ')!\n'))
     share_var.sub_main_pkg[sub_pkg_name] = pkg_name
 
     share_var.pkg_print_index[sub_pkg_name] = 0
@@ -240,7 +240,7 @@ def remove_cycle(main_pkg_edges, full_in_edge_count):
         for dst in dst_pkgs:
             if dst in path:
                 # cycle!
-                print("removing cycle (" + node + "->" + dst + ")")
+                print(("removing cycle (" + node + "->" + dst + ")"))
                 if node not in cycle_edges:
                     cycle_edges[node] = set()
                 cycle_edges[node].add(dst)
@@ -250,7 +250,7 @@ def remove_cycle(main_pkg_edges, full_in_edge_count):
                 visit(level + 1, dst)
         path.remove(node)
 
-    for pkg in main_pkg_edges.keys():
+    for pkg in list(main_pkg_edges.keys()):
         visit(0, pkg)
 
     return main_pkg_edges, cycle_edges, full_in_edge_count
@@ -398,7 +398,7 @@ def make_dep_graph(input_file_contents, dest_dir_name, package_name_ids):
     main_pkg_reverse_edges = {}
     full_in_reverse_edge_count = {}
     # generate main_pkg_edges using sub_pkg_edges
-    for src, dst_pkgs in share_var.sub_pkg_edges.items():
+    for src, dst_pkgs in list(share_var.sub_pkg_edges.items()):
         src_main = find_main_package_name(src, share_var)
         if src_main is None:
             continue
index 575bb8615ef1d573ba0460ee862a40213de76f5a..e1040ebceb1b98ac5b6ee795672df1867e286ce8 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #
 # Copyright (c) 2021 Samsung Electronics.Co.Ltd.
index 312b72828aa61ae1f983a65fc1046320d0af15a7..ff54b098c83019a0a73750ea1ef027e260a4c3f3 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #
 # Copyright (c) 2021 Samsung Electronics.Co.Ltd.
index eec185bb8fc542a71027009b6c2ba3887e65aeb5..805fcae249cc6394b025101cac808747365f4afe 100755 (executable)
@@ -30,8 +30,8 @@ try:
     import http.server
     import socketserver
 except ImportError:
-    import SimpleHTTPServer
-    import SocketServer
+    import http.server
+    import socketserver
 
 from datetime import datetime, timedelta
 
@@ -39,7 +39,7 @@ from datetime import datetime, timedelta
 def console(text, level='INFO', verbose=False):
     """logging wrapper"""
     if verbose is True:
-        print('[{}] {}'.format(level, text))
+        print(('[{}] {}'.format(level, text)))
         sys.stdout.flush()
 
 
@@ -242,8 +242,8 @@ def serve_web(port, root_dir):
             handler = http.server.SimpleHTTPRequestHandler
             httpd = socketserver.TCPServer(("", port), handler)
         except NameError:
-            handler = SimpleHTTPServer.SimpleHTTPRequestHandler
+            handler = http.server.SimpleHTTPRequestHandler
             handler.extensions_map.update({'.webapp': 'application/x-web-app-manifest+json'})
-            httpd = SocketServer.TCPServer(("", port), handler)
+            httpd = socketserver.TCPServer(("", port), handler)
         httpd.allow_reuse_address = True
         httpd.serve_forever()
index f2c757a679c6514608eaa808ef1621f4110fd800..323e2970a5cda472215ecb1a2caaaad7b919bf27 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 """A setuptools based setup module.
 """
index a2d37d54cd267ff6f918062ceb8fd48c51f54608..ddae7a1c250e72cfe31b6d8e9755de44ac517577 100755 (executable)
@@ -2,17 +2,17 @@ Source: gbs
 Section: devel
 Priority: extra
 Maintainer: Jian-feng Ding <jian-feng.ding@intel.com>
-Build-Depends: debhelper, python (>= 2.6), python-docutils, python-setuptools
+Build-Depends: debhelper, dh-python, python3, python3-docutils, python3-setuptools
 Standards-Version: 3.8.0
 X-Python-Version: >= 2.6
 Homepage: http://www.tizen.org
 
 Package: gbs
 Architecture: all
-Depends: ${misc:Depends}, ${python:Depends},
- python-pycurl,
- python-requests,
- python-lxml,
+Depends: ${misc:Depends}, ${python3:Depends},
+ python3-pycurl,
+ python3-requests,
+ python3-lxml,
  sudo,
  osc (>= 0.132.6),
  git-buildpackage-rpm (>= 0.9.21-tizen20210514),
@@ -28,8 +28,8 @@ Description: Command line tools for Tizen package developers
 
 Package: gbs-api
 Architecture: all
-Depends: ${misc:Depends}, ${python:Depends},
- python-pycurl,
+Depends: ${misc:Depends}, ${python3:Depends},
+ python3-pycurl,
  osc (>= 0.132.6),
  git-buildpackage-rpm
 Conflicts: gbs (<< 0.15)
@@ -40,7 +40,7 @@ Description: GBS API
 
 Package: gbs-export
 Architecture: all
-Depends: ${misc:Depends}, ${python:Depends},
+Depends: ${misc:Depends}, ${python3:Depends},
  gbs-api (= ${binary:Version}),
  pristine-tar (>= 1.35-tizen20161231),
  git-buildpackage-rpm
@@ -52,7 +52,7 @@ Description: GBS export API
 
 Package: gbs-remotebuild
 Architecture: all
-Depends: ${misc:Depends}, ${python:Depends},
+Depends: ${misc:Depends}, ${python3:Depends},
  gbs-api (= ${binary:Version}),
  gbs-export (= ${binary:Version}),
  git-buildpackage-rpm
@@ -78,7 +78,7 @@ Description: Jenkins scripts used by gbs-jenkins-job
 
 Package: gbs-bsr
 Architecture: all
-Depends: ${misc:Depends}, ${python:Depends},
- python-psutil
+Depends: ${misc:Depends}, ${python3:Depends},
+ python3-psutil
 Description: GBS build monitirong scripts
  This package monitors the build status and generates report using the relevant data.
index 3d82e78224be96c2136650174dee8cfcc48a462d..2e96989e96ea6a39c9458b9ebdb89f79f0bb89cb 100644 (file)
@@ -1,12 +1,12 @@
 #!/usr/bin/make -f
 
 %:
-       dh $@
+       dh $@ --with python3 --buildsystem=pybuild
 
 override_dh_auto_install:
-       python setup.py install --root=debian/tmp --prefix=/usr
+       python3 setup.py install --root=debian/tmp --prefix=/usr
        make man
-       cd bsr && python setup.py install --install-scripts=/usr/local/bin --root=../debian/tmp --prefix=/usr/local && cd ..
+       cd bsr && python3 setup.py install --install-scripts=/usr/local/bin --root=../debian/tmp --prefix=/usr/local && cd ..
        mkdir -p debian/tmp/usr/share/man/man1
        mkdir -p debian/tmp/usr/share/gbs
        install -m644 docs/gbs.1 debian/tmp/usr/share/man/man1
index 5b76dbafc704752e35427c725ee4e98574696806..a83b27480448f483d774edd31d576c3b1eebfb76 100644 (file)
@@ -23,7 +23,7 @@ import os
 import shutil
 import pwd
 import re
-import urlparse
+import urllib.parse
 import glob
 import gzip
 import requests
@@ -140,7 +140,7 @@ def prepare_repos_and_build_conf(args, arch, profile):
     if args.repositories:
         for repo in args.repositories:
             try:
-                if not urlparse.urlsplit(repo).scheme:
+                if not urllib.parse.urlsplit(repo).scheme:
                     if os.path.exists(repo):
                         repo = os.path.abspath(os.path.expanduser(repo))
                     else:
@@ -426,7 +426,7 @@ def create_autoconf(arch, snapshot, full_build):
 
     content += '[general]\nfallback_to_native = true\nprofile = ' + default + '\n'
     repos_map = {}
-    for k, v in obs_meta.iteritems():
+    for k, v in obs_meta.items():
         ref_id = ref_meta.get(v)
         if ref_id == None:
             ref_id = 'latest'
@@ -463,7 +463,7 @@ def create_autoconf(arch, snapshot, full_build):
             content += '[repo.' + k + '_' + repo + '_pkgs]\n'
             content += 'url = ' + url + '/builddata/depends/' + v + '_' + repo + '_' + arch + '_revpkgdepends.xml\n'
 
-    for k, v in profile_meta.iteritems():
+    for k, v in profile_meta.items():
         content += '[profile.' + k + ']\n'
         if full_build:
             v = v[:v.index('repo.' + k) - 1]
index d9ecc2055dcb9cc0c006c152eb7d1c45092aefe5..73d79911e63391c98e2d328b50f3d5523382f783 100644 (file)
@@ -22,7 +22,7 @@ import os
 import shutil
 import pwd
 import re
-import urlparse
+import urllib.parse
 import glob
 import requests
 import subprocess
@@ -81,7 +81,7 @@ def prepare_repos_and_build_conf(args, arch, profile):
     if args.repositories:
         for repo in args.repositories:
             try:
-                if not urlparse.urlsplit(repo).scheme:
+                if not urllib.parse.urlsplit(repo).scheme:
                     if os.path.exists(repo):
                         repo = os.path.abspath(os.path.expanduser(repo))
                     else:
index 6ad01903384386b883ea31cd3c890fc8b49a02d4..6fb743e59c408d3d5045bdfeb8d2a9ecbbf3d1f3 100644 (file)
@@ -68,8 +68,8 @@ def update_local_conf(repo, values):
     log.info('Updating local .gbs.conf')
     with open(conf_fn, 'a+') as conf_fp:
         parser.readfp(conf_fp)
-    for section, items in values.iteritems():
-        for key, value in items.iteritems():
+    for section, items in values.items():
+        for key, value in items.items():
             parser.set_into_file(section, key, value)
     parser.update()
 
index eea01f0010693a24358047c190d96a0745fc05c3..99b71aab76a1837ce919718afaef36bca064fe75 100644 (file)
@@ -24,7 +24,7 @@ import re
 import shutil
 import glob
 import errno
-from urlparse import urlparse
+from urllib.parse import urlparse
 
 from gitbuildsys import utils
 from gitbuildsys.conf import configmgr
@@ -122,7 +122,7 @@ def create_gbp_export_args(repo, commit, export_dir, tmp_dir, spec, args,
     reponame = ""
     remotes = repo.get_remote_repos()
     if remotes:
-        remotename = 'origin' if 'origin' in remotes else remotes.keys()[0]
+        remotename = 'origin' if 'origin' in remotes else list(remotes.keys())[0]
         # Take the remote repo of current branch, if available
         try:
             config_remote = repo.get_config('branch.%s.remote' % repo.branch)
index 887fca6637871c65b063a0d42542f5648c4d6ab5..bbde549dba5aeab1bb29ddc2b6e78b0604ce1d5a 100644 (file)
@@ -160,11 +160,11 @@ def main(args):
             archlist = []
             status = api.get_results(target_prj, package)
 
-            for build_repo in status.keys():
+            for build_repo in list(status.keys()):
                 for arch in status[build_repo]:
                     archlist.append('%-15s%-15s' % (build_repo, arch))
-            if not obs_repo or not obs_arch or obs_repo not in status.keys() \
-                   or obs_arch not in status[obs_repo].keys():
+            if not obs_repo or not obs_arch or obs_repo not in list(status.keys()) \
+                   or obs_arch not in list(status[obs_repo].keys()):
                 raise GbsError('no valid repo / arch specified for buildlog, '\
                                'valid arguments of repo and arch are:\n%s' % \
                                '\n'.join(archlist))
@@ -175,7 +175,7 @@ def main(args):
                                                   status[obs_repo][obs_arch]))
             log.info('build log for %s/%s/%s/%s' % (target_prj, package,
                                                     obs_repo, obs_arch))
-            print(api.get_buildlog(target_prj, package, obs_repo, obs_arch))
+            print((api.get_buildlog(target_prj, package, obs_repo, obs_arch)))
 
             return 0
 
@@ -184,7 +184,7 @@ def main(args):
 
             status = api.get_results(target_prj, package)
 
-            for build_repo in status.keys():
+            for build_repo in list(status.keys()):
                 for arch in status[build_repo]:
                     stat = status[build_repo][arch]
                     results.append('%-15s%-15s%-15s' % (build_repo, arch, stat))
index a0fd40ae7ac949bfc2c40696698d4a9db4e69f6b..12cf5a6be627f9da83118eb35ddbc9f3186baaef 100644 (file)
 Provides classes and functions to read and write gbs.conf.
 '''
 
-from __future__ import with_statement
+
 import os
 import re
 import base64
 import shutil
 from collections import namedtuple
-from ConfigParser import SafeConfigParser,  \
+from configparser import SafeConfigParser,  \
                          MissingSectionHeaderError, Error
 
 from gitbuildsys import errors
@@ -257,9 +257,9 @@ url = http://download.tizen.org/releases/daily/trunk/ivi/latest/
     def _create_default_parser(self):
         'create a default parser that handle DEFAULTS values'
         parser = BrainConfigParser()
-        for sec, options in self.DEFAULTS.iteritems():
+        for sec, options in self.DEFAULTS.items():
             parser.add_section(sec)
-            for key, val in options.iteritems():
+            for key, val in options.items():
                 parser.set(sec, key, val)
         return parser
 
@@ -381,22 +381,19 @@ url = http://download.tizen.org/releases/daily/trunk/ivi/latest/
             try:
                 return cfgparser.get(section, opt)
             except Error as err:
-                pass
-        raise errors.ConfigError(err)
+                raise errors.ConfigError(err)
 
     def options(self, section='general'):
         'merge and return options of certain section from multi-levels'
         sect_found = False
+        global gerr
         options = set()
         for cfgparser in self._cfgparsers:
             try:
                 options.update(cfgparser.options(section))
                 sect_found = True
             except Error as err:
-                pass
-
-        if not sect_found:
-            raise errors.ConfigError(err)
+                raise errors.ConfigError(err)
 
         return options
 
@@ -599,7 +596,7 @@ class BizConfigManager(ConfigMgr):
         except KeyError as err:
             raise errors.ConfigError('unknown key: %s. Supportted '\
                     'keys are %s' % (str(err), ' '.join( \
-                    self.DEFAULTS['general'].keys())))
+                    list(self.DEFAULTS['general'].keys()))))
         return value
 
     def is_profile_oriented(self):
@@ -766,7 +763,7 @@ class BizConfigManager(ConfigMgr):
                     repos[key]['passwd'] = value
                 else:
                     repos[key][name] = value
-        return sorted(repos.items(), key=lambda i: i[0])
+        return sorted(list(repos.items()), key=lambda i: i[0])
 
     def _build_profile_by_subcommand(self):
         '''return profile object from subcommand oriented style of config'''
index 930d5d1cb81b1001f476cc015c342ea1d79b6822..23afe392cc1f0754a3b827166aa106c0ff10c3e3 100644 (file)
@@ -24,13 +24,14 @@ Only APIs which are required by cmd_remotebuild present here.
 
 import os
 import re
-import urllib2
+import urllib.request, urllib.error, urllib.parse
 import M2Crypto
 from M2Crypto.SSL.Checker import SSLVerificationError
 import ssl
 
 from collections import defaultdict
-from urllib import quote_plus, pathname2url
+from urllib.parse import quote_plus
+from urllib.request import pathname2url
 
 from xml.etree import cElementTree as ET
 
@@ -60,7 +61,7 @@ class OSC(object):
                                    'for specified oscrc: %s' % oscrc)
 
                 raise # else
-            except urllib2.URLError:
+            except urllib.error.URLError:
                 raise ObsError("invalid service apiurl: %s" % apiurl)
         else:
             conf.get_config()
@@ -79,13 +80,13 @@ class OSC(object):
         for count in (1, 2, 3):
             try:
                 return method(url, data=data, file=filep)
-            except (urllib2.URLError, M2Crypto.m2urllib2.URLError,
+            except (urllib.error.URLError, M2Crypto.m2urllib2.URLError,
                     M2Crypto.SSL.SSLError, ssl.SSLError) as err:
                 if count == 3:
                     raise OSCError(str(err))
 
         raise OSCError('Got empty response from %s %s' % \
-                       (method.func_name.split('_')[-1], url))
+                       (method.__name__.split('_')[-1], url))
 
     def get_repos_of_project(self, project):
         """Get dictionary name: list of archs for project repos"""
@@ -161,7 +162,7 @@ class OSC(object):
         try:
             # Create project and set its meta
             core.edit_meta('prj', path_args=quote_plus(target), data=meta)
-        except (urllib2.URLError, M2Crypto.m2urllib2.URLError,
+        except (urllib.error.URLError, M2Crypto.m2urllib2.URLError,
                 M2Crypto.SSL.SSLError) as err:
             raise ObsError("Can't set meta for %s: %s" % (target, str(err)))
 
@@ -172,7 +173,7 @@ class OSC(object):
         # copy project config
         try:
             config = core.show_project_conf(self.apiurl, src)
-        except (urllib2.URLError, M2Crypto.m2urllib2.URLError,
+        except (urllib.error.URLError, M2Crypto.m2urllib2.URLError,
                 M2Crypto.SSL.SSLError) as err:
             raise ObsError("Can't get config from project %s: %s" \
                            % (src, str(err)))
@@ -205,10 +206,10 @@ class OSC(object):
         try:
             core.meta_exists(metatype=metatype, path_args=path_args,
                              create_new=False, apiurl=self.apiurl)
-        except urllib2.HTTPError as err:
+        except urllib.error.HTTPError as err:
             if err.code == 404:
                 return False
-        except (urllib2.URLError, M2Crypto.m2urllib2.URLError, \
+        except (urllib.error.URLError, M2Crypto.m2urllib2.URLError, \
                 M2Crypto.SSL.SSLError) as err:
             pass
         except SSLVerificationError:
@@ -222,7 +223,7 @@ class OSC(object):
         """Rebuild package."""
         try:
             return core.rebuild(self.apiurl, prj, pkg, repo=None, arch=arch)
-        except (urllib2.URLError, M2Crypto.m2urllib2.URLError, \
+        except (urllib.error.URLError, M2Crypto.m2urllib2.URLError, \
                 M2Crypto.SSL.SSLError) as err:
             raise ObsError("Can't trigger rebuild for %s/%s: %s" % \
                            (prj, pkg, str(err)))
@@ -269,7 +270,7 @@ class OSC(object):
             else:
                 new.append(lpath)
 
-        return rdict.keys(), not_changed, changed, new
+        return list(rdict.keys()), not_changed, changed, new
 
     @waiting
     def commit_files(self, prj, pkg, files, message):
@@ -318,7 +319,7 @@ class OSC(object):
         results = defaultdict(dict)
         try:
             build_status = core.get_results(self.apiurl, prj, pkg)
-        except (urllib2.URLError, M2Crypto.m2urllib2.URLError,
+        except (urllib.error.URLError, M2Crypto.m2urllib2.URLError,
                 M2Crypto.SSL.SSLError) as err:
             raise ObsError("can't get %s/%s build results: %s" \
                            % (prj, pkg, str(err)))
@@ -348,7 +349,7 @@ class OSC(object):
             raise ObsError("can't get %s/%s build log: %s" % (prj, pkg, err))
 
         return log.translate(None, "".join([chr(i) for i in \
-                                            range(10) + range(11, 32)]))
+                                            list(range(10)) + list(range(11, 32))]))
 
     @staticmethod
     def get_path(prj, pkg=None):
index e62829e91dfdd589be5cbaf4a8aefd1f58753eed..0b4981bfa23014e3ffb4106608100c641410016f 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # vim: ai ts=4 sts=4 et sw=4
 #
 # Copyright (c) 2011 Intel, Inc.
@@ -35,7 +35,7 @@ class GbsHelpFormatter(RawDescriptionHelpFormatter):
         """Collect aliases."""
 
         if action.choices:
-            for item, parser in action.choices.iteritems():
+            for item, parser in action.choices.items():
                 self._aliases[str(item)] = parser.get_default('alias')
 
         return super(GbsHelpFormatter, self).add_argument(action)
index 1293e639f6f7c2f1fe50ddad5e7ad73dfa7cb162..4671518c1b356ca3958e1fd5b769d65a811ba022 100644 (file)
@@ -20,8 +20,8 @@ This module provides a class SafeURL which can contain url/user/password read
 from config file, and hide plain user and password when it print to screen
 """
 
-import urllib
-import urlparse
+import urllib.request, urllib.parse, urllib.error
+import urllib.parse
 
 
 class SafeURL(str):
@@ -38,7 +38,7 @@ class SafeURL(str):
         inst.user, inst.passwd = SafeURL._check_userinfo(inline_user,
                                                          inline_passwd,
                                                          user, passwd)
-        inst.components = urlparse.urlsplit(safe_url)
+        inst.components = urllib.parse.urlsplit(safe_url)
         return inst
 
     @property
@@ -57,7 +57,7 @@ class SafeURL(str):
 
         new_components = list(self.components)
         new_components[1] = login
-        return urlparse.urlunsplit(new_components)
+        return urllib.parse.urlunsplit(new_components)
 
     def is_local(self):
         'return True is it is local path'
@@ -65,7 +65,7 @@ class SafeURL(str):
 
     def pathjoin(self, args):
         '''treat self as path and urljoin'''
-        new = urlparse.urljoin(self.rstrip('/') + '/', args)
+        new = urllib.parse.urljoin(self.rstrip('/') + '/', args)
         return SafeURL(new, self.user, self.passwd)
 
     def _get_userinfo(self):
@@ -73,19 +73,19 @@ class SafeURL(str):
         if not self.user:
             return ''
 
-        escape = lambda raw: urllib.quote(raw, safe='')
+        escape = lambda raw: urllib.parse.quote(raw, safe='')
         return '%s:%s' % (escape(self.user), escape(self.passwd)) \
             if self.passwd else escape(self.user)
 
     @staticmethod
     def _extract_userinfo(url):
         '''strip inline user/password from url'''
-        results = urlparse.urlsplit(url)
+        results = urllib.parse.urlsplit(url)
         hostport = SafeURL._get_hostport(results)
 
         components = list(results)
         components[1] = hostport
-        safe_url = urlparse.urlunsplit(components)
+        safe_url = urllib.parse.urlunsplit(components)
 
         return safe_url, results.username, results.password
 
index 8224290d01231748e497f7f85a6a8081e7e87e73..becd0fdf9b36fc5ecc504bd7637f11f8cb6c63e5 100644 (file)
@@ -623,7 +623,7 @@ class GerritNameMapper(object):
 
         lst_node = root.getiterator("package")
         for node in lst_node:
-            if node.attrib.has_key("name"):
+            if "name" in node.attrib:
                 for child in node.getchildren():
                     if child.tag == 'source':
                         self._pkg2src[node.attrib['name']] = child.text
index b31a7177067f1101aeeedd610392cc1811395520..6a6414df50349a1648d19bf9069c73c8225eed84 100755 (executable)
@@ -1,5 +1,4 @@
-%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-%{!?python_version: %define python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])")}
+%{!?python3_sitelib: %define python3_sitelib %(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')}
 
 %define jobs_dir /var/lib/jenkins/jobs
 %define scripts_dir /var/lib/jenkins/jenkins-scripts
@@ -17,18 +16,15 @@ License:    GPLv2
 BuildArch:  noarch
 URL:        http://www.tizen.org
 Source0:    %{name}_%{version}.tar.gz
-Requires:   python >= 2.6
-Requires:   python-pycurl
-Requires:   python-requests
-Requires:   python-lxml
+Requires:   python3
+Requires:   python3-pycurl
+Requires:   python3-requests
+Requires:   python3-lxml
 Requires:   sudo
 Requires:   osc >= 0.132.6
 Requires:   tizen-gbp-rpm >= 20210514
 Requires:   depanneur >= 0.16.18
 
-%if "%{?python_version}" < "2.7"
-Requires:   python-argparse
-%endif
 %if ! 0%{?tizen_version:1}
 Requires:   rpm-tizen >= 4.11.0.1.tizen20130618-tizen20131001
 %endif
@@ -36,8 +32,8 @@ Requires:   %{name}-api = %{version}-%{release}
 Requires:   %{name}-export = %{version}-%{release}
 Requires:   %{name}-remotebuild = %{version}-%{release}
 
-BuildRequires:  python-docutils
-BuildRequires:  python-setuptools
+BuildRequires:  python3-docutils
+BuildRequires:  python3-setuptools
 BuildRoot:  %{_tmppath}/%{name}-%{version}-build
 
 %description
@@ -47,8 +43,8 @@ be used to do packaging related tasks.
 %package api
 Summary:       GBS APIs
 Conflicts:     gbs < 0.15
-Requires:      python
-Requires:      python-pycurl
+Requires:      python3
+Requires:      python3-pycurl
 Requires:      osc >= 0.132.6
 Requires:      git-buildpackage-rpm
 
@@ -59,7 +55,7 @@ external software.
 %package export
 Summary:       GBS export module
 Conflicts:     gbs < 0.15
-Requires:      python
+Requires:      python3
 Requires:      tizen-pristine-tar >= 20161231
 Requires:      gbs-api = %{version}-%{release}
 Requires:      git-buildpackage-rpm
@@ -71,7 +67,7 @@ external software.
 %package remotebuild
 Summary:       GBS remotebuild module
 Conflicts:     gbs < 0.18.1
-Requires:      python
+Requires:      python3
 Requires:      gbs-api = %{version}-%{release}
 Requires:      gbs-export = %{version}-%{release}
 Requires:      git-buildpackage-rpm
@@ -110,9 +106,9 @@ and generates a report using the relevant data.
 
 
 %build
-%{__python} setup.py build
+python3 setup.py build
 make man
-pushd bsr && %{__python} setup.py build && popd
+pushd bsr && python3 setup.py build && popd
 
 %pre
 /usr/bin/getent group jenkins >/dev/null || /usr/sbin/groupadd -r jenkins &>/dev/null || :
@@ -120,8 +116,8 @@ pushd bsr && %{__python} setup.py build && popd
     -d "%{workdir}" jenkins &>/dev/null || :
 
 %install
-%{__python} setup.py install --prefix=%{_prefix} --root=%{buildroot}
-pushd bsr && %{__python} setup.py install --prefix=%{_prefix} --root=%{buildroot} && popd
+python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
+pushd bsr && python3 setup.py install --prefix=%{_prefix} --root=%{buildroot} && popd
 
 
 mkdir -p %{buildroot}/%{_prefix}/share/man/man1
@@ -142,6 +138,9 @@ done
 mkdir -p %{buildroot}/%{scripts_dir}
 install -m755 jenkins-jobs/scripts/*  %{buildroot}/%{scripts_dir}
 
+#remove /usr/lib/python3.*/site-packages/gitbuildsys/__pycache__/ directory
+rm -rf %{buildroot}/%{python3_sitelib}/gitbuildsys/__pycache__
+
 %clean
 rm -rf %{buildroot}
 
@@ -151,40 +150,40 @@ rm -rf %{buildroot}
 %dir %{_prefix}/share/gbs
 %{_mandir}/man1/*
 %{_prefix}/share/gbs/*
-%{python_sitelib}/gitbuildsys/cmd_build.py*
-%{python_sitelib}/gitbuildsys/cmd_changelog.py*
-%{python_sitelib}/gitbuildsys/cmd_chroot.py*
-%{python_sitelib}/gitbuildsys/cmd_clone.py*
-%{python_sitelib}/gitbuildsys/cmd_createimage.py*
-%{python_sitelib}/gitbuildsys/cmd_devel.py*
-%{python_sitelib}/gitbuildsys/cmd_import.py*
-%{python_sitelib}/gitbuildsys/cmd_pull.py*
-%{python_sitelib}/gitbuildsys/cmd_submit.py*
-%{python_sitelib}/gitbuildsys/cmd_depends.py*
-%{python_sitelib}/gitbuildsys/parsing.py*
+%{python3_sitelib}/gitbuildsys/cmd_build.py*
+%{python3_sitelib}/gitbuildsys/cmd_changelog.py*
+%{python3_sitelib}/gitbuildsys/cmd_chroot.py*
+%{python3_sitelib}/gitbuildsys/cmd_clone.py*
+%{python3_sitelib}/gitbuildsys/cmd_createimage.py*
+%{python3_sitelib}/gitbuildsys/cmd_devel.py*
+%{python3_sitelib}/gitbuildsys/cmd_import.py*
+%{python3_sitelib}/gitbuildsys/cmd_pull.py*
+%{python3_sitelib}/gitbuildsys/cmd_submit.py*
+%{python3_sitelib}/gitbuildsys/cmd_depends.py*
+%{python3_sitelib}/gitbuildsys/parsing.py*
 %{_bindir}/gbs
 %{_sysconfdir}/bash_completion.d
 %{_sysconfdir}/zsh_completion.d
 
 %files api
 %defattr(-,root,root,-)
-%dir %{python_sitelib}/gitbuildsys
-%{python_sitelib}/gitbuildsys/__init__.py*
-%{python_sitelib}/gitbuildsys/oscapi.py*
-%{python_sitelib}/gitbuildsys/errors.py*
-%{python_sitelib}/gitbuildsys/log.py*
-%{python_sitelib}/gitbuildsys/safe_url.py*
-%{python_sitelib}/gitbuildsys/conf.py*
-%{python_sitelib}/gitbuildsys/utils.py*
-%{python_sitelib}/gbs-*-py*.egg-info
+%dir %{python3_sitelib}/gitbuildsys
+%{python3_sitelib}/gitbuildsys/__init__.py*
+%{python3_sitelib}/gitbuildsys/oscapi.py*
+%{python3_sitelib}/gitbuildsys/errors.py*
+%{python3_sitelib}/gitbuildsys/log.py*
+%{python3_sitelib}/gitbuildsys/safe_url.py*
+%{python3_sitelib}/gitbuildsys/conf.py*
+%{python3_sitelib}/gitbuildsys/utils.py*
+%{python3_sitelib}/gbs-*-py*.egg-info
 
 %files export
 %defattr(-,root,root,-)
-%{python_sitelib}/gitbuildsys/cmd_export.py*
+%{python3_sitelib}/gitbuildsys/cmd_export.py*
 
 %files remotebuild
 %defattr(-,root,root,-)
-%{python_sitelib}/gitbuildsys/cmd_remotebuild.py*
+%{python3_sitelib}/gitbuildsys/cmd_remotebuild.py*
 
 %files jenkins-jobs
 %defattr(-,root,root,-)
@@ -205,5 +204,5 @@ rm -rf %{buildroot}
 
 %files bsr
 %defattr(-,root,root,-)
-%{python_sitelib}/bsr*
+%{python3_sitelib}/bsr*
 %{_bindir}/bsr
index 42519dfcb82114077acc4fdd2fc09e45210b71f4..d101c7aeea61a022832831d2f63d17e23fd0f097 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 """GBS setup."""
 
@@ -27,7 +27,7 @@ def get_version(mod_name):
     """Get version from module __init__.py"""
     path = os.path.join(mod_name, "__init__.py")
     if not os.path.isfile(path):
-        print('No %s version file found' % path)
+        print(('No %s version file found' % path))
         sys.exit(1)
 
     content = open(path).read()
@@ -36,7 +36,7 @@ def get_version(mod_name):
     if match:
         return match.group(1)
 
-    print('Unable to find version in %s' % path)
+    print(('Unable to find version in %s' % path))
     sys.exit(1)
 
 check_debian()
index fbae7db2980245de0774e944ec12e4270d148563..feda74f6921033d05d526486bde54d74b5805ecb 100644 (file)
@@ -75,7 +75,7 @@ class Fixture(object):
             patch('gitbuildsys.conf.os.path.exists', self.fake_exists),
             patch('gitbuildsys.conf.os.path.expanduser', self.fake_expanduser),
             patch('gitbuildsys.conf.os.path.abspath', self.fake_abspath),
-            patch('ConfigParser.open', self.fake_open, create=True),
+            patch('configparser.ConfigParser.open', self.fake_open, create=True),
             ]
         for patcher in patchers:
             func = patcher(func)
@@ -132,7 +132,7 @@ class ConfigGettingTest(unittest.TestCase):
     @Fixture(home='home1.ini')
     def test_default_value(self):
         'test get hardcode default value '
-        self.assertEquals('/var/tmp', self.get('general', 'tmpdir'))
+        self.assertEqual('/var/tmp', self.get('general', 'tmpdir'))
 
     @Fixture(home='without_section_header.ini')
     def test_invalid_ini(self):
@@ -147,7 +147,7 @@ class ConfigGettingTest(unittest.TestCase):
     @Fixture(home='interpolation.ini')
     def test_interpolation(self):
         'test interpolation is supported'
-        self.assertEquals('abc/def', self.get('remote', 'target'))
+        self.assertEqual('abc/def', self.get('remote', 'target'))
 
     @Fixture(home='home1.ini')
     def test_addconf(self):
index d7d7d4813fe78c7fe079628fedbdb51657e257f2..186366a034cf89476811f570372d24e60adc6e3c 100644 (file)
@@ -36,7 +36,7 @@ class TestHelp(unittest.TestCase):
                     "chroot", "chr"]:
 
             try:
-                print('>>>sub', sub)
+                print(('>>>sub', sub))
                 GBS(argv=["gbs", sub, "--help"])
             except SystemExit as err:
                 eq_(err.code, 0)
index d63e1936f44d411ad493224e069fc91186699989..b7cb5399c6d4ca10241fc98c67fc9d755e899d4b 100644 (file)
@@ -17,7 +17,7 @@
 # Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 """Functional tests for setting passwdx back to config"""
 import unittest
-from StringIO import StringIO
+from io import StringIO
 
 from mock import patch
 
@@ -67,7 +67,7 @@ class PasswdxTest(unittest.TestCase):
 
         reload(gitbuildsys.conf)
 
-        self.assertEquals('''[remotebuild]
+        self.assertEqual('''[remotebuild]
 build_server = https://api
 passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s
 
@@ -90,7 +90,7 @@ repo1.passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s
 
         reload(gitbuildsys.conf)
 
-        self.assertEquals('''[remotebuild]
+        self.assertEqual('''[remotebuild]
 build_server = https://api
 passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s
 
@@ -99,7 +99,7 @@ repo1.url = https://repo1
 repo1.passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s
 ''', confs[0].getvalue())
 
-        self.assertEquals('''[remotebuild]
+        self.assertEqual('''[remotebuild]
 build_server = https://api
 user = test
 passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s
@@ -117,7 +117,7 @@ repo1.passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s
         reload(gitbuildsys.conf)
 
         pwd = gitbuildsys.conf.configmgr.get('passwd', 'remotebuild')
-        self.assertEquals('secret', pwd)
+        self.assertEqual('secret', pwd)
 
     @Fixture(home='plain_passwd.ini')
     def test_get_passwd(self, fake_open):
@@ -127,7 +127,7 @@ repo1.passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s
         reload(gitbuildsys.conf)
 
         pwd = gitbuildsys.conf.configmgr.get('passwd', 'remotebuild')
-        self.assertEquals('secret', pwd)
+        self.assertEqual('secret', pwd)
 
     @Fixture(home='bad_passwdx.ini')
     def test_bad_passwdx(self, _fake_open):
@@ -143,7 +143,7 @@ repo1.passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s
         reload(gitbuildsys.conf)
 
         pwd = gitbuildsys.conf.configmgr.get('passwd', 'remotebuild')
-        self.assertEquals('', pwd)
+        self.assertEqual('', pwd)
 
 
 @patch('gitbuildsys.conf.os.chmod')
index 562d9f4d00c2735d0d7e3717997171bf76865809..93898eb7c4da85612e7cc8771194b3ff116fa28d 100644 (file)
@@ -40,24 +40,24 @@ class ProfileStyleTest(unittest.TestCase):
     @Fixture(home='profile.ini')
     def test_profile_api(self):
         'test get obs api'
-        self.assertEquals('https://api.tz/path', get_profile().obs.url)
+        self.assertEqual('https://api.tz/path', get_profile().obs.url)
 
     @Fixture(home='profile.ini')
     def test_api_inherit_auth(self):
         'test api can inherit auto from parent profile section'
-        self.assertEquals('https://Alice:secret@api.tz/path',
+        self.assertEqual('https://Alice:secret@api.tz/path',
                           get_profile().obs.url.full)
 
     @Fixture(home='profile_only_has_api.ini')
     def test_api_auth_can_be_overwrite(self):
         'test api auth can be overwrite'
-        self.assertEquals('https://Bob:classified@api.tz/path',
+        self.assertEqual('https://Bob:classified@api.tz/path',
                           get_profile().obs.url.full)
 
     @Fixture(home='profile.ini')
     def test_profile_repos_in_order(self):
         'repos must be in same order as they are write in config'
-        self.assertEquals(['https://repo/ia32/main',
+        self.assertEqual(['https://repo/ia32/main',
                            'https://repo/ia32/non-oss',
                            'https://repo/ia32/base',
                            '/local/path'],
@@ -66,29 +66,29 @@ class ProfileStyleTest(unittest.TestCase):
     @Fixture(home='profile.ini')
     def test_repo_inherit_auth(self):
         'test repo can inherit auth from parent section'
-        self.assertEquals('https://Alice:secret@repo/ia32/main',
+        self.assertEqual('https://Alice:secret@repo/ia32/main',
                           get_profile().repos[0].url.full)
 
     @Fixture(home='profile.ini')
     def test_repo_overwrite_auth(self):
         'test repo auth can be overwrite'
-        self.assertEquals('https://Bob:classified@repo/ia32/base',
+        self.assertEqual('https://Bob:classified@repo/ia32/base',
                           get_profile().repos[2].url.full)
 
     @Fixture(home='bug387_inherit_only_user.ini')
     def test_inherit_only_user(self):
         'test inherit only user from parent'
-        self.assertEquals('https://tester:secret@repo',
+        self.assertEqual('https://tester:secret@repo',
                           get_profile().repos[0].url.full)
-        self.assertEquals('https://tester:secret@obs',
+        self.assertEqual('https://tester:secret@obs',
                           get_profile().obs.url.full)
 
     @Fixture(home='bug387_inherit_only_passwdx.ini')
     def test_inherit_only_passwdx(self):
         'test inherit only password from parent'
-        self.assertEquals('https://tester:secret@repo',
+        self.assertEqual('https://tester:secret@repo',
                           get_profile().repos[0].url.full)
-        self.assertEquals('https://tester:secret@obs',
+        self.assertEqual('https://tester:secret@obs',
                           get_profile().obs.url.full)
 
     @Fixture(home='bug387_only_password_no_user.ini')
@@ -99,7 +99,7 @@ class ProfileStyleTest(unittest.TestCase):
     @Fixture(home='bug387_inline_auth_has_the_highest_priority.ini')
     def test_inline_highest_priority(self):
         'test inline auth has the highest priority'
-        self.assertEquals('https://this:inline-pwd@obs',
+        self.assertEqual('https://this:inline-pwd@obs',
                           get_profile().obs.url.full)
 
     @Fixture(home='no_such_profile_section_name.ini')
@@ -112,23 +112,23 @@ class ProfileStyleTest(unittest.TestCase):
         'test get a empty profile'
         profile = get_profile()
 
-        self.assertEquals(None, profile.obs)
-        self.assertEquals([], profile.repos)
+        self.assertEqual(None, profile.obs)
+        self.assertEqual([], profile.repos)
 
     @Fixture(home='profile.ini')
     def test_local_repo_need_not_auth(self):
         '''test local path needn't auth info'''
-        self.assertEquals('/local/path', get_profile().repos[3].url.full)
+        self.assertEqual('/local/path', get_profile().repos[3].url.full)
 
     @Fixture(home='profile.ini')
     def test_obs_base_project(self):
         'test read base project from conf'
-        self.assertEquals('base', get_profile().obs.base)
+        self.assertEqual('base', get_profile().obs.base)
 
     @Fixture(home='profile.ini')
     def test_obs_target_project(self):
         'test read target project from conf'
-        self.assertEquals('target', get_profile().obs.target)
+        self.assertEqual('target', get_profile().obs.target)
 
 
 @patch('gitbuildsys.conf.open', MagicMock(), create=True)
@@ -139,18 +139,18 @@ class SubcommandStyleTest(unittest.TestCase):
     @Fixture(home='subcommand.ini')
     def test_api(self):
         'test obs api'
-        self.assertEquals('https://api/build/server', get_profile().obs.url)
+        self.assertEqual('https://api/build/server', get_profile().obs.url)
 
     @Fixture(home='subcommand.ini')
     def test_api_auth(self):
         'test api auth'
-        self.assertEquals('https://Alice:secret@api/build/server',
+        self.assertEqual('https://Alice:secret@api/build/server',
                           get_profile().obs.url.full)
 
     @Fixture(home='subcommand.ini')
     def test_repos_in_order(self):
         'repos list must be in the same order as they are write in config'
-        self.assertEquals(['https://repo1/path',
+        self.assertEqual(['https://repo1/path',
                            'https://repo2/path',
                            '/local/path/repo'],
                           [i.url for i in get_profile().repos])
@@ -158,7 +158,7 @@ class SubcommandStyleTest(unittest.TestCase):
     @Fixture(home='subcommand.ini')
     def test_repo_auth(self):
         'test repo auth'
-        self.assertEquals('https://Alice:secret@repo1/path',
+        self.assertEqual('https://Alice:secret@repo1/path',
                           get_profile().repos[0].url.full)
 
 
@@ -175,7 +175,7 @@ class ConvertTest(unittest.TestCase):
 
         get_profile()
 
-        self.assertEquals(conf.getvalue(), '''[general]
+        self.assertEqual(conf.getvalue(), '''[general]
 profile = profile.current
 
 [obs.remotebuild]
index 73233faade8a1fb5919e15fb2a1b7f30c9e6863e..7d920f01d4ae95e0ada46d481a0fafe1a7fe1246 100755 (executable)
--- a/tools/gbs
+++ b/tools/gbs
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
 # vim: ai ts=4 sts=4 et sw=4
 #
 # Copyright (c) 2011 Intel, Inc.