!4 remove python2 subpackage

From: @lei_ju
Reviewed-by: @xiezhipeng1
Signed-off-by: @xiezhipeng1
This commit is contained in:
openeuler-ci-bot 2020-10-29 19:43:55 +08:00 committed by Gitee
commit 694d45dc21

View File

@ -3,17 +3,15 @@
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, \
Python3 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
Release: 12
Summary: Missing compatibility layer on 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
@ -22,16 +20,8 @@ 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
Summary: Missing compatibility layer on Python 3
%{?python_provide:%python_provide python3-future}
BuildRequires: python3-devel python3-setuptools python3-numpy python3-requests python3-pytest
@ -41,25 +31,17 @@ BuildRequires: python3-devel python3-setuptools python3-numpy python3-requests
%prep
%autosetup -c -p1
mv python-future-%{version} python2
cd python2
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
mv python-future-%{version} python3
cd python3
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
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
@ -77,46 +59,12 @@ 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}
@ -131,6 +79,9 @@ cd ..
%{python3_sitelib}/*
%changelog
* Wed Oct 21 2020 leiju <leiju4@huawei.com> - 0.16.0-12
- remove python2 subpackage
* Thu Jan 09 2020 lihao <lihao129@huawei.com> - 0.16.0-11
- Package Init