%define name python3-pytest %define srcname pytest %define version 5.3.1 %define release 1 # The (old) Bull version of RPM python-docutls left ".py" suffix on rst2* tools %define RST2HTML rst2html %define dotests 1 # Needs care because default command python may be linked to 32 or 64 bit python # and compiler/loader options are not the same, e.g. -maix32/-maix64 # Also, although %define is_python %(test -e /opt/freeware/bin/python3_32 && echo 1 || echo 0) %if %{is_python} %define python_sitelib %(/opt/freeware/bin/python3_32 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))") %endif %define _libdir64 %{_prefix}/lib64 %define is_python_64 %(test -e /opt/freeware/bin/python3_64 && echo 1 || echo 0) %if %{is_python_64} %define python_sitelib64 %(/opt/freeware/bin/python3 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))") %endif # The test in this specfile use pytest-timeout.When building pytest for the first time with new Python version that is not possible as it depends on pytest %global timeout 0 %global pylib_version 1.4.29 Name: %{name} Version: %{version} Release: %{release} Summary: Simple powerful testing with Python License: MIT Group: Development/Libraries URL: http://pytest.org Source0: https://files.pythonhosted.org/packages/source/p/%{srcname}/%{srcname}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prefix: %{_prefix} BuildArch: noarch Requires: python3-attrs >= 19.3.0-1 Requires: python3-importlib-metadata >= 0.23-1 Requires: python3-packaging >= 19.2-1 Requires: python3-wcwidth >= 0.1.7-1 Requires: python3-pluggy >= 0.13.0-1 Requires: python3-py >= 1.8.0-1 Requires: python3-more-itertools >= 7.2.0-1 BuildRequires: python3-docutils >= 0.15.2-1 BuildRequires: python3-py >= 1.8.0-1 BuildRequires: python3-pygments-pytest >= 1.3.1-1 BuildRequires: python3-sphinx-removed-in >= 0.2.1-1 BuildRequires: python3-sphinxcontrib-trio >= 1.1.0-1 BuildRequires: python3-pluggy >= 0.13.0-1 BuildRequires: python3-wcwidth >= 0.1.7 %if %{with timeout} BuildRequires: python3-pytest-timeout %endif Provides: %{name} = %{version}-%{release} %description py.test provides simple, yet powerful testing for Python. %prep %setup -q -n %{srcname}-%{version} echo "dotests=%{dotests}" %build export PATH=/opt/freeware/bin:$PATH /opt/freeware/bin/python3 setup.py build for l in doc/* ; do make -C $l html PYTHONPATH=$(pwd)/src SPHINXBUILD="sphinx-build-3" done for f in README CHANGELOG CONTRIBUTING ; do %{RST2HTML} ${f}.rst > ${f}.html done %install [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT /opt/freeware/bin/python3 setup.py install --skip-build --root ${RPM_BUILD_ROOT} mv %{buildroot}%{_bindir}/pytest %{buildroot}%{_bindir}/pytest-3.7 ln -sf pytest-3.7 %{buildroot}%{_bindir}/pytest-3 mv %{buildroot}%{_bindir}/py.test %{buildroot}%{_bindir}/py.test-3.7 ln -sf py.test-3.7 %{buildroot}%{_bindir}/py.test-3 mkdir -p _htmldocs/html for l in doc/* ; do # remove hidden file rm ${l}/_build/html/.buildinfo mv ${l}/_build/html _htmldocs/html/${l##doc/} done # remove shebangs from all scripts find %{buildroot}%{python_sitelib} \ -name '*.py' \ find %{buildroot}%{python_sitelib} \ -name '*.py' \ -exec sed -i -e '1{/^#!/d}' {} \; if [ "%{dotests}" == 1 ] then (PATH=%{buildroot}%{_bindir}:${PATH} \ PYTHONPATH=%{buildroot}%{python_sitelib} \ %{buildroot}%{_bindir}/pytest-3 -r s testing \ %if %{timeout} --timeout=20 %endif || true) fi cd ${RPM_BUILD_ROOT} mkdir -p usr/bin cd usr/bin ln -sf ../..%{_bindir}/* . %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files -n %{name} %if %{with docs} %doc CHANGELOG.html %doc README.html %doc CONTRIBUTING.html %doc _htmldocs/html %endif %license LICENSE %{_bindir}/pytest-3 %{_bindir}/pytest-3.7 %{_bindir}/py.test-3 %{_bindir}/py.test-3.7 %{python_sitelib}/pytest-*.egg-info/ %{python_sitelib}/_pytest/ %{python_sitelib}/pytest.py %{python_sitelib}/__pycache__/pytest.* %changelog * Mon Nov 18 2019 Baanu Tumma - 5.2.1-1 - update to 5.2.1 * Wed Sep 20 2017 Ravi Hirekurabar - 3.1.3-1 - Updated to 3.1.3 * Wed May 10 2017 Michael Wilson - 3.0.7-1 - Update to version 3.0.7 * Tue Jun 11 2013 Tristan Delhalle - 2.3.5-1 - first version for AIX V6.1 and higher