From 837b7abe5fe6d12b66f4be4b28d98b482e9fcfc1 Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Feb 08 2018 03:42:02 +0000 Subject: Improve testenv for py26 Original testenv for py26 works well, but it requires newer version of setuptools which is not avaialbe in EL6 and EL7 and that causes failure to build EPEL 6 and 7 packages. Instead of making changes to SPEC file, this patch improves the test env provision for py26 specifically in tox.ini, the result would make it work in both tox and building the RPM packages. * pypi.txt and test-pypi.txt does not include any platform specifier and only list packages that rpkg requires. * install_requires and tests_require are modified in setup.py according to the Python version. Specific packages that are required for Python 2.6 are added. * Provision py26 testenv specifically in tox.ini. * Tests still run with `GitPython<1.0.0` in Python 2.6. * Comments are cleaned in pypi.txt. Signed-off-by: Chenxiong Qi --- diff --git a/requirements/pypi.txt b/requirements/pypi.txt index 1d1b148..3ab24b9 100644 --- a/requirements/pypi.txt +++ b/requirements/pypi.txt @@ -1,31 +1,14 @@ # List of Python packages that can be installed from PyPI. +# There are dependent packages for running with Python 2.6, and those will be +# handled in setup.py. cccolutils >= 1.4 +GitPython +koji >= 1.15 pycurl >= 7.19 requests rpm-py-installer six >= 1.9.0 -GitPython >= 1.0 ; python_version > "2.6" - # openidc-client # used for MBS OIDC authentication # requests-kerberos # used for MBS Kerberos authentication - -# There are dependent packages for running with Python 2.6, and those will be -# handled in setup.py. - -# setuptools support is supported since version 1.15. -# Requires koji>=1.15.0 -# Install koji from source code and tag koji-1.15.0 without waiting for Koji -# developers to publish it to PyPI. -koji >= 1.15 - -# Several package that are not available in PyPI are also listed here. -# If rpkg runs from a Python virtualenv, you may need --site-packages to create -# the environment so that following Python modules can be imported. -# -# Please see also fedora-py2.txt or fedora-py3.txt to install them in your -# system. - -GitPython < 1.0 ; python_version < "2.7" -argparse == 1.4.0 ; python_version < "2.7" \ No newline at end of file diff --git a/requirements/test-pypi.txt b/requirements/test-pypi.txt index a648c30..4330608 100644 --- a/requirements/test-pypi.txt +++ b/requirements/test-pypi.txt @@ -1,7 +1,6 @@ -r pypi.txt coverage -flake8 == 3.5.0 mock == 1.0.1 nose == 1.3.7 @@ -9,5 +8,3 @@ nose == 1.3.7 openidc-client git+https://pagure.io/rpmfluff.git@0.5.1#egg=rpmfluff - -unittest2 ; python_version < "2.7" \ No newline at end of file diff --git a/setup.py b/setup.py index 0cf6159..56edd79 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ #!/usr/bin/python import os +import sys from setuptools import setup, find_packages @@ -34,6 +35,17 @@ install_requires, dep_links = read_requirements(pypi_txt) tests_require, test_dep_links = read_requirements(test_pypi_txt) dep_links += test_dep_links +ver = sys.version_info +if ver[0] <= 2 and ver[1] < 7: + install_requires.remove('GitPython') + install_requires += [ + 'GitPython<1.0.0', + 'argparse==1.4.0', + ] + tests_require += [ + 'unittest2' + ] + setup( name="rpkg", diff --git a/tox.ini b/tox.ini index 2af5a75..c5295c3 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,13 @@ commands = {toxinidir}/pip-pycurl nosetests {posargs} +[testenv:py26] +commands = + pip install -I "setuptools<37.0.0" "wheel<0.30.0" unittest2 + {[testenv]commands} + [testenv:flake8] basepython = python3 +skip_install = True deps = flake8 == 3.5.0 commands = flake8 pyrpkg/ tests/