__author_email__ = 'hyokeun.jeon@samsung.com'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2020 Samsung Research'
-__cake__ = u'\u2728 \U0001f370 \u2728'
+__cake__ = '\u2728 \U0001f370 \u2728'
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 Samsung Electronics.Co.Ltd.
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
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)
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 Samsung Electronics.Co.Ltd.
import shutil
try:
- from ConfigParser import SafeConfigParser
+ from configparser import SafeConfigParser
except ImportError:
from configparser import SafeConfigParser
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 Samsung Electronics.Co.Ltd.
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'))
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'))
# 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:
# 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:
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
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)
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
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
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 Samsung Electronics.Co.Ltd.
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 Samsung Electronics.Co.Ltd.
import http.server
import socketserver
except ImportError:
- import SimpleHTTPServer
- import SocketServer
+ import http.server
+ import socketserver
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()
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()
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""A setuptools based setup module.
"""
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),
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)
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
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
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.
#!/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
import shutil
import pwd
import re
-import urlparse
+import urllib.parse
import glob
import gzip
import requests
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:
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'
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]
import shutil
import pwd
import re
-import urlparse
+import urllib.parse
import glob
import requests
import subprocess
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:
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()
import shutil
import glob
import errno
-from urlparse import urlparse
+from urllib.parse import urlparse
from gitbuildsys import utils
from gitbuildsys.conf import configmgr
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)
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))
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
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))
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
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
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
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):
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'''
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
'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()
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"""
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)))
# 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)))
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:
"""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)))
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):
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)))
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):
-#!/usr/bin/env python
+#!/usr/bin/env python3
# vim: ai ts=4 sts=4 et sw=4
#
# Copyright (c) 2011 Intel, Inc.
"""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)
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):
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
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'
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):
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
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
-%{!?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
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
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
%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
%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
%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
%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 || :
-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
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}
%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,-)
%files bsr
%defattr(-,root,root,-)
-%{python_sitelib}/bsr*
+%{python3_sitelib}/bsr*
%{_bindir}/bsr
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""GBS setup."""
"""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()
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()
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)
@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):
@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):
"chroot", "chr"]:
try:
- print('>>>sub', sub)
+ print(('>>>sub', sub))
GBS(argv=["gbs", sub, "--help"])
except SystemExit as err:
eq_(err.code, 0)
# 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
reload(gitbuildsys.conf)
- self.assertEquals('''[remotebuild]
+ self.assertEqual('''[remotebuild]
build_server = https://api
passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s
reload(gitbuildsys.conf)
- self.assertEquals('''[remotebuild]
+ self.assertEqual('''[remotebuild]
build_server = https://api
passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s
repo1.passwdx = QlpoOTFBWSZTWYfNdxYAAAIBgAoAHAAgADDNAMNEA24u5IpwoSEPmu4s
''', confs[0].getvalue())
- self.assertEquals('''[remotebuild]
+ self.assertEqual('''[remotebuild]
build_server = https://api
user = test
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):
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):
reload(gitbuildsys.conf)
pwd = gitbuildsys.conf.configmgr.get('passwd', 'remotebuild')
- self.assertEquals('', pwd)
+ self.assertEqual('', pwd)
@patch('gitbuildsys.conf.os.chmod')
@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'],
@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')
@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')
'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)
@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])
@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)
get_profile()
- self.assertEquals(conf.getvalue(), '''[general]
+ self.assertEqual(conf.getvalue(), '''[general]
profile = profile.current
[obs.remotebuild]
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# vim: ai ts=4 sts=4 et sw=4
#
# Copyright (c) 2011 Intel, Inc.