%if 0%{?fedora} || 0%{?rhel} >= 8
%global with_py3 1
%endif
%global srcname random2
Name: python-%{srcname}
Version: 1.0.1
Release: 6%{?dist}
Summary: Python 2 compatible random module
License: Python
URL: http://pypi.python.org/pypi/%{srcname}
Source0: https://pypi.python.org/packages/source/r/%{srcname}/%{srcname}-%{version}.zip
BuildArch: noarch
BuildRequires: python-devel
BuildRequires: python-setuptools
%if 0%{?with_py3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%endif
%global common_desc \
This package provides a Python 3 ported version of Python 2.7's random \
module. It has also been back-ported to work in Python 2.6. \
\
In Python 3, the implementation of randrange() was changed, so that even \
with the same seed you get different sequences in Python 2 and 3. Note \
that several high-level functions such as randint() and choice() use \
randrange(). \
\
In my testing code I heavily rely on stable random generator results and \
it makes porting code to Python 3 a lot harder, if all those tests have \
to be adjusted. This package fixes that.
%description
%{common_desc}
%package -n python2-%{srcname}
Summary: Python 2 compatible random module
%{?python_provide:%python_provide python2-%{srcname}}
%description -n python2-%{srcname}
%{common_desc}
%if 0%{?with_py3}
%package -n python3-%{srcname}
Summary: Python 2 compatible random module for Python 3
%{?python_provide:%python_provide python3-%{srcname}}
%description -n python3-%{srcname}
%{common_desc}
%endif
%prep
%setup -q -c
# Remove prebuilt egg
rm -fr %{srcname}-%{version}/src/%{srcname}.egg-info
%if 0%{?with_py3}
# Prepare for a python3 build
cp -a %{srcname}-%{version} python3-%{srcname}-%{version}
%endif
%build
# Python 2 build
pushd %{srcname}-%{version}
%py2_build
popd
%if 0%{?with_py3}
# Python 3 build
pushd python3-%{srcname}-%{version}
%py3_build
popd
%endif
%install
# Python 2 install
pushd %{srcname}-%{version}
%py2_install
popd
%if 0%{?with_py3}
# Python 3 install
pushd python3-%{srcname}-%{version}
%py3_install
popd
%endif
%check
# Python 2 tests
pushd %{srcname}-%{version}
%{__python2} setup.py test
popd
%if 0%{?with_py3}
# Python 3 tests
pushd python3-%{srcname}-%{version}
%{__python3} setup.py test
popd
%endif
%files -n python2-%{srcname}
%doc %{srcname}-%{version}/CHANGES.txt %{srcname}-%{version}/README.txt
%{python2_sitelib}/*
%if 0%{?with_py3}
%files -n python3-%{srcname}
%doc %{srcname}-%{version}/CHANGES.txt %{srcname}-%{version}/README.txt
%{python3_sitelib}/*
%endif
%changelog
* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 1.0.1-6
- Rebuild for Python 3.6
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.1-5
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Mon Feb 1 2016 Jerry James <loganjerry@gmail.com> - 1.0.1-3
- Comply with latest python packaging guidelines
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.1-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Mon Jun 9 2014 Jerry James <loganjerry@gmail.com> - 1.0.1-1
- Initial RPM