%global with_tests 0%{?_with_tests:0} %global desc \ This package intends to provides a compatibility layer for Python between its \ two version release. The future and past packages are both provides for backports \ and forwards, in which you are able to use a single, clean codebase to run under \ Python2/3 environmets easily. With also providing futurize and pasteurize scripts, \ you can convert you Python code to support both version. %{!?python2_shortver: %global python2_shortver %(%{__python2} -c 'import sys; print(str(sys.version_info.major) + "." + str(sys.version_info.minor))')} %{!?python3_shortver: %global python3_shortver %(%{__python3} -c 'import sys; print(str(sys.version_info.major) + "." + str(sys.version_info.minor))')} Name: future Version: 0.16.0 Release: 11 Summary: Missing compatibility layer between Python 2 and Python 3 License: MIT URL: http://python-future.org/ Source0: https://github.com/PythonCharmers/python-future/archive/v%{version}.tar.gz#/python-future-%{version}.tar.gz BuildArch: noarch %description %{desc} %package -n python2-future Summary: Missing compatibility layer between Python 2 and Python 3 %{?python_provide:%python_provide python2-future} BuildRequires: python2-devel python2-setuptools python2-numpy python2-requests python2-pytest Provides: future = 0:%{version}-%{release} %description -n python2-future %{desc} %package -n python3-future Summary: Missing compatibility layer between Python 2 and Python 3 %{?python_provide:%python_provide python3-future} BuildRequires: python3-devel python3-setuptools python3-numpy python3-requests python3-pytest %description -n python3-future %{desc} %prep %autosetup -c -p1 mv python-future-%{version} python2 cd python2 find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|' cd .. cp -a python2 python3 find python3 -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' %build cd python2 CFLAGS="%{optflags}" %{__python2} setup.py build --executable="%{__python2} -s" cd .. cd python3 CFLAGS="%{optflags}" %{__python3} setup.py build --executable="%{__python3} -s" cd .. %install cd python3 CFLAGS="%{optflags}" %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT mv $RPM_BUILD_ROOT%{_bindir}/futurize $RPM_BUILD_ROOT%{_bindir}/python3-futurize mv $RPM_BUILD_ROOT%{_bindir}/pasteurize $RPM_BUILD_ROOT%{_bindir}/python3-pasteurize sed -i -e '/^#!\//, 1d' $RPM_BUILD_ROOT%{python3_sitelib}/future/backports/test/pystone.py touch futurize-3 futurize-%{?python3_shortver} install -p futurize-3 futurize-%{?python3_shortver} $RPM_BUILD_ROOT%{_bindir} ln -sf %{_bindir}/python3-futurize $RPM_BUILD_ROOT%{_bindir}/futurize-3 ln -sf %{_bindir}/python3-futurize $RPM_BUILD_ROOT%{_bindir}/futurize-%{?python3_shortver} touch pasteurize-3 pasteurize-%{?python3_shortver} install -p pasteurize-3 pasteurize-%{?python3_shortver} $RPM_BUILD_ROOT%{_bindir} ln -sf %{_bindir}/python3-pasteurize $RPM_BUILD_ROOT%{_bindir}/pasteurize-3 ln -sf %{_bindir}/python3-pasteurize $RPM_BUILD_ROOT%{_bindir}/pasteurize-%{?python3_shortver} cd .. cd python2 CFLAGS="%{optflags}" %{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT cp -p $RPM_BUILD_ROOT%{_bindir}/futurize $RPM_BUILD_ROOT%{_bindir}/python%{python2_version}-futurize cp -p $RPM_BUILD_ROOT%{_bindir}/pasteurize $RPM_BUILD_ROOT%{_bindir}/python%{python2_version}-pasteurize touch futurize futurize-2 futurize-%{python2_version} install -p futurize futurize-2 futurize-%{python2_version} $RPM_BUILD_ROOT%{_bindir} ln -sf %{_bindir}/python%{python2_version}-futurize $RPM_BUILD_ROOT%{_bindir}/futurize ln -sf %{_bindir}/python%{python2_version}-futurize $RPM_BUILD_ROOT%{_bindir}/futurize-2 ln -sf %{_bindir}/python%{python2_version}-futurize $RPM_BUILD_ROOT%{_bindir}/futurize-%{python2_version} touch pasteurize pasteurize-2 pasteurize-%{python2_version} install -p pasteurize pasteurize-2 pasteurize-%{python2_version} $RPM_BUILD_ROOT%{_bindir} ln -sf %{_bindir}/python%{python2_version}-pasteurize $RPM_BUILD_ROOT%{_bindir}/pasteurize ln -sf %{_bindir}/python%{python2_version}-pasteurize $RPM_BUILD_ROOT%{_bindir}/pasteurize-2 ln -sf %{_bindir}/python%{python2_version}-pasteurize $RPM_BUILD_ROOT%{_bindir}/pasteurize-%{python2_version} sed -i -e '/^#!\//, 1d' $RPM_BUILD_ROOT%{python2_sitelib}/future/backports/test/pystone.py cd .. %check %if %{with_tests} cd python2 PYTHONPATH=$PWD/build/lib py.test -v cd .. cd python3 PYTHONPATH=$PWD/build/lib py.test-3 -v cd .. %endif %files -n python2-future %{!?_licensedir:%global license %doc} %doc python2/README.rst %license python2/LICENSE.txt %{_bindir}/futurize %{_bindir}/futurize-2* %{_bindir}/pasteurize %{_bindir}/pasteurize-2* %{_bindir}/python%{python2_version}-futurize %{_bindir}/python%{python2_version}-pasteurize %{python2_sitelib}/* %files -n python3-future %{!?_licensedir:%global license %doc} %license python3/LICENSE.txt %doc python3/README.rst %{_bindir}/futurize-3 %{_bindir}/futurize-%{?python3_shortver} %{_bindir}/pasteurize-3 %{_bindir}/pasteurize-%{?python3_shortver} %{_bindir}/python3-futurize %{_bindir}/python3-pasteurize %{python3_sitelib}/* %changelog * Thu Jan 09 2020 lihao - 0.16.0-11 - Package Init