Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2
authorChenxiong Qi <cqi@redhat.com>
Sun, 25 Mar 2018 07:34:59 +0000 (15:34 +0800)
committerDodji Seketeli <dodji@redhat.com>
Thu, 29 Mar 2018 11:46:50 +0000 (13:46 +0200)
commit1ac0c055fa1892b4f4565fca3b13ecc3d7cf2391
treebec96fd9ffebd8ba49fc81b0450a17d82a4a3615
parent7642dc158638cbf4170fc8ba987ccca16cab3ea5
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2

This patch makes fedabipkgdiff Python 3 compatible.  All tests written
in Python are updated and compatible with Python 3 as well.

The patch looks for a Python 3 interperter.  If it finds one then it
runs the tests using that interpreter.  Otherwise it just tries to use
the Python 2 interpreter.

This behaviour can be disabled by the new --disable-python3 option.

* configure.ac: Add new option --enable-python3. Add new
test runner file tests/runtestdefaultsupprs-py3 and
tests/runtestfedabipkgdiffpy3.sh. Add required six Python module.
* tests/Makefile.am: Add new test files
tests/runtestdefaultsupprspy3.sh and
tests/runtestfedabipkgdiffpy3.sh accordingly.
* tests/mockfedabipkgdiff.in: Convert print statement to
six.print_. Replace call to function filter with list
comprehension. Replace basestring with six.string_types.
* tests/runtestdefaultsupprspy3.sh.in: New shell script to run
test runtestdefaultsupprs with Python 3.
* tests/runtestdefaultsupprs.py.in: Repalce a few tabs with
proper number of spaces which is detected by Python 3
interpreter.
* tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run
test runtestfedabipkgdiff with Python 3.
* tests/runtestfedabipkgdiff.py.in: Use python from env in
shebang instead of a fixed path to a Python interpreter.
* tools/fedabipkgdiff: Globally replace print statement with a
function call to print which is available by importing
print_function from __future__ module. Use six.print_ to output
string to stderr instead. Convert function call to map to
for-loop. (cmp_nvr): Change argument to handle a Koji build
mapping instead of only the nvr. (Brew.listBuilds): use the new
cmp_nvr to sort builds.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
.gitignore
configure.ac
tests/Makefile.am
tests/mockfedabipkgdiff.in
tests/runtestdefaultsupprs.py.in
tests/runtestdefaultsupprspy3.sh.in [new file with mode: 0644]
tests/runtestfedabipkgdiff.py.in
tests/runtestfedabipkgdiffpy3.sh.in [new file with mode: 0644]
tools/fedabipkgdiff