%{!?dotests: %define dotests 1} %define name python3-unittest2 %define srcname unittest2 %define version 1.1.0 %define release 1 %define is_python %(test -e /usr/bin/python3_32 && echo 1 || echo 0) %if %{is_python} %define python_sitelib %(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 /usr/bin/python3_64 && echo 1 || echo 0) %if %{is_python_64} %define python_sitelib64 %(python3 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))") %endif Summary: The new features in unittest for Python 2.7 backported to Python 2.3+. Name: %{name} Version: %{version} Release: %{release} Source0: %{srcname}-%{version}.tar.gz License: UNKNOWN Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prefix: %{_prefix} BuildArch: noarch Vendor: Michael Foord Url: http://pypi.python.org/pypi/unittest2 Patch1: unittest2-backport-test.patch BuildRequires: python3 >= 3.7, python3-devel >= 3.7 Requires: python3 >= 3.7, python3-argparse >= 1.4.0, python3-six >= 1.12.0, python3-traceback2 >= 1.4.0 %description unittest2 is a backport of the new features added to the unittest testing framework in Python 2.7. It is tested to run on Python 2.4 - 2.7. To use unittest2 instead of unittest simply replace ``import unittest`` with ``import unittest2``. %prep %setup -q -n %{srcname}-%{version} %patch1 -p0 %build python3 setup.py build if [ "%{dotests}" == 1 ] then (python3 setup.py test) fi %install [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT python3 setup.py install --skip-build --root ${RPM_BUILD_ROOT} #renaming the files in bindir to avoid conflict with python-unittest2 cd ${RPM_BUILD_ROOT}/%{_bindir} mv unit2 unit2-3 cd ${RPM_BUILD_ROOT} mkdir -p usr/bin cd usr/bin ln -sf ../..%{_bindir}/* . %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system,-) %doc PKG-INFO README.txt %{_bindir}/* /usr/bin/* %{python_sitelib}/* %changelog * Sat Nov 23 2019 Baanu tumma - 1.1.0-1 - Built using python3 * Wed Sep 20 2017 Ravi Hirekurabar -1.1.0-1 - Updated to 1.1.0 * Wed Jun 12 2013 Tristan Delhalle - 0.5.1-1 - first version for AIX V6.1 and higher