No more with python3
There is no point of building this without python3 and this makes the spec a bit more readable. Also: - only have one %python_wheelname (can be split in future if needed) - use pythonX -m pytest instead of py.test-X.Y
This commit is contained in:
parent
6186a480fa
commit
3e1ef986b4
@ -2,24 +2,12 @@
|
|||||||
%bcond_with tests
|
%bcond_with tests
|
||||||
|
|
||||||
%bcond_without python2
|
%bcond_without python2
|
||||||
%bcond_without python3
|
|
||||||
%if %{without python3}
|
|
||||||
%bcond_with doc
|
|
||||||
%else
|
|
||||||
%bcond_without doc
|
%bcond_without doc
|
||||||
%endif
|
|
||||||
|
|
||||||
%global srcname pip
|
%global srcname pip
|
||||||
%global python_wheelname %{srcname}-%{version}-py2.py3-none-any.whl
|
%global python_wheelname %{srcname}-%{version}-py2.py3-none-any.whl
|
||||||
%global python_wheeldir %{_datadir}/python-wheels
|
%global python_wheeldir %{_datadir}/python-wheels
|
||||||
%if %{without bootstrap}
|
|
||||||
%if %{with python2}
|
|
||||||
%global python2_wheelname %python_wheelname
|
|
||||||
%endif
|
|
||||||
%if %{with python3}
|
|
||||||
%global python3_wheelname %python_wheelname
|
|
||||||
%endif
|
|
||||||
%endif
|
|
||||||
%if %{with doc}
|
%if %{with doc}
|
||||||
%global pypa_theme_commit_hash d2e63fbfc62af3b7050f619b2f5bb8658985b931
|
%global pypa_theme_commit_hash d2e63fbfc62af3b7050f619b2f5bb8658985b931
|
||||||
%endif
|
%endif
|
||||||
@ -189,7 +177,6 @@ Packages" or "Pip Installs Python".
|
|||||||
%endif # with python2
|
%endif # with python2
|
||||||
|
|
||||||
|
|
||||||
%if %{with python3}
|
|
||||||
%package -n python%{python3_pkgversion}-%{srcname}
|
%package -n python%{python3_pkgversion}-%{srcname}
|
||||||
Summary: A tool for installing and managing Python3 packages
|
Summary: A tool for installing and managing Python3 packages
|
||||||
Group: Development/Libraries
|
Group: Development/Libraries
|
||||||
@ -234,8 +221,6 @@ A documentation for a tool for installing and managing Python packages
|
|||||||
|
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%endif # with python3
|
|
||||||
|
|
||||||
%if %{without bootstrap}
|
%if %{without bootstrap}
|
||||||
%package wheel
|
%package wheel
|
||||||
Summary: The pip wheel
|
Summary: The pip wheel
|
||||||
@ -249,11 +234,6 @@ A Python wheel of pip to use with venv.
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%if %{with doc} && %{without python3}
|
|
||||||
echo "This combination (with doc, without python3) is unsupported"
|
|
||||||
exit 1
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%setup -q -n %{srcname}-%{version}
|
%setup -q -n %{srcname}-%{version}
|
||||||
%if %{with tests}
|
%if %{with tests}
|
||||||
tar -xf %{SOURCE1}
|
tar -xf %{SOURCE1}
|
||||||
@ -281,13 +261,11 @@ popd
|
|||||||
%endif
|
%endif
|
||||||
%endif # with python2
|
%endif # with python2
|
||||||
|
|
||||||
%if %{with python3}
|
|
||||||
%if %{without bootstrap}
|
%if %{without bootstrap}
|
||||||
%py3_build_wheel
|
%py3_build_wheel
|
||||||
%else
|
%else
|
||||||
%py3_build
|
%py3_build
|
||||||
%endif
|
%endif
|
||||||
%endif # with python3
|
|
||||||
|
|
||||||
%if %{with doc}
|
%if %{with doc}
|
||||||
pushd docs
|
pushd docs
|
||||||
@ -300,9 +278,8 @@ popd
|
|||||||
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%if %{with python3}
|
|
||||||
%if %{without bootstrap}
|
%if %{without bootstrap}
|
||||||
%py3_install_wheel %{python3_wheelname}
|
%py3_install_wheel %{python_wheelname}
|
||||||
%else
|
%else
|
||||||
%py3_install
|
%py3_install
|
||||||
%endif
|
%endif
|
||||||
@ -310,7 +287,6 @@ popd
|
|||||||
# TODO: we have to remove this by hand now, but it'd be nice if we wouldn't have to
|
# TODO: we have to remove this by hand now, but it'd be nice if we wouldn't have to
|
||||||
# (pip install wheel doesn't overwrite)
|
# (pip install wheel doesn't overwrite)
|
||||||
rm %{buildroot}%{_bindir}/pip
|
rm %{buildroot}%{_bindir}/pip
|
||||||
%endif # with python3
|
|
||||||
|
|
||||||
%if %{with doc}
|
%if %{with doc}
|
||||||
pushd docs/build/man
|
pushd docs/build/man
|
||||||
@ -320,16 +296,14 @@ for MAN in *1; do
|
|||||||
install -pm0644 $MAN %{buildroot}%{_mandir}/man1/$MAN
|
install -pm0644 $MAN %{buildroot}%{_mandir}/man1/$MAN
|
||||||
install -pm0644 $MAN %{buildroot}%{_mandir}/man1/${MAN/pip/pip2}
|
install -pm0644 $MAN %{buildroot}%{_mandir}/man1/${MAN/pip/pip2}
|
||||||
%endif
|
%endif
|
||||||
%if %{with python3}
|
|
||||||
install -pm0644 $MAN %{buildroot}%{_mandir}/man1/${MAN/pip/pip3}
|
install -pm0644 $MAN %{buildroot}%{_mandir}/man1/${MAN/pip/pip3}
|
||||||
%endif
|
|
||||||
done
|
done
|
||||||
popd
|
popd
|
||||||
%endif # with doc
|
%endif # with doc
|
||||||
|
|
||||||
%if %{with python2}
|
%if %{with python2}
|
||||||
%if %{without bootstrap}
|
%if %{without bootstrap}
|
||||||
%py2_install_wheel %{python2_wheelname}
|
%py2_install_wheel %{python_wheelname}
|
||||||
%else
|
%else
|
||||||
%py2_install
|
%py2_install
|
||||||
%endif
|
%endif
|
||||||
@ -350,11 +324,9 @@ PYTHONPATH=%{buildroot}%{python2_sitelib} \
|
|||||||
%{buildroot}%{_bindir}/pip completion --bash \
|
%{buildroot}%{_bindir}/pip completion --bash \
|
||||||
> %{buildroot}%{bashcompdir}/pip
|
> %{buildroot}%{bashcompdir}/pip
|
||||||
%endif
|
%endif
|
||||||
%if %{with python3}
|
|
||||||
PYTHONPATH=%{buildroot}%{python3_sitelib} \
|
PYTHONPATH=%{buildroot}%{python3_sitelib} \
|
||||||
%{buildroot}%{_bindir}/pip3 completion --bash \
|
%{buildroot}%{_bindir}/pip3 completion --bash \
|
||||||
> %{buildroot}%{bashcompdir}/pip3
|
> %{buildroot}%{bashcompdir}/pip3
|
||||||
%endif
|
|
||||||
pips2=pip
|
pips2=pip
|
||||||
pips3=pip3
|
pips3=pip3
|
||||||
for pip in %{buildroot}%{_bindir}/pip*; do
|
for pip in %{buildroot}%{_bindir}/pip*; do
|
||||||
@ -368,21 +340,18 @@ for pip in %{buildroot}%{_bindir}/pip*; do
|
|||||||
%endif
|
%endif
|
||||||
;;
|
;;
|
||||||
%endif
|
%endif
|
||||||
%if %{with python3}
|
|
||||||
pip3?*)
|
pip3?*)
|
||||||
pips3="$pips3 $pip"
|
pips3="$pips3 $pip"
|
||||||
%if 0%{?bashcomp2}
|
%if 0%{?bashcomp2}
|
||||||
ln -s pip3 %{buildroot}%{bashcompdir}/$pip
|
ln -s pip3 %{buildroot}%{bashcompdir}/$pip
|
||||||
%endif
|
%endif
|
||||||
;;
|
;;
|
||||||
%endif
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
%if %{with python3}
|
|
||||||
sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips3/" \
|
sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips3/" \
|
||||||
-e s/_pip_completion/_pip3_completion/ \
|
-e s/_pip_completion/_pip3_completion/ \
|
||||||
%{buildroot}%{bashcompdir}/pip3
|
%{buildroot}%{bashcompdir}/pip3
|
||||||
%endif
|
|
||||||
%if %{with python2}
|
%if %{with python2}
|
||||||
sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips2/" \
|
sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips2/" \
|
||||||
%{buildroot}%{bashcompdir}/pip
|
%{buildroot}%{bashcompdir}/pip
|
||||||
@ -393,10 +362,9 @@ sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips2/" \
|
|||||||
ln -s ./pip%{python2_version} %{buildroot}%{_bindir}/pip-%{python2_version}
|
ln -s ./pip%{python2_version} %{buildroot}%{_bindir}/pip-%{python2_version}
|
||||||
ln -s ./pip-%{python2_version} %{buildroot}%{_bindir}/pip-2
|
ln -s ./pip-%{python2_version} %{buildroot}%{_bindir}/pip-2
|
||||||
%endif
|
%endif
|
||||||
%if %{with python3}
|
|
||||||
ln -s ./pip%{python3_version} %{buildroot}%{_bindir}/pip-%{python3_version}
|
ln -s ./pip%{python3_version} %{buildroot}%{_bindir}/pip-%{python3_version}
|
||||||
ln -s ./pip-%{python3_version} %{buildroot}%{_bindir}/pip-3
|
ln -s ./pip-%{python3_version} %{buildroot}%{_bindir}/pip-3
|
||||||
%endif
|
|
||||||
|
|
||||||
|
|
||||||
# Make sure the INSTALLER is not pip, otherwise Patch2 won't work
|
# Make sure the INSTALLER is not pip, otherwise Patch2 won't work
|
||||||
@ -405,18 +373,13 @@ ln -s ./pip-%{python3_version} %{buildroot}%{_bindir}/pip-3
|
|||||||
%if %{with python2}
|
%if %{with python2}
|
||||||
echo rpm > %{buildroot}%{python2_sitelib}/pip-%{version}.dist-info/INSTALLER
|
echo rpm > %{buildroot}%{python2_sitelib}/pip-%{version}.dist-info/INSTALLER
|
||||||
%endif
|
%endif
|
||||||
%if %{with python3}
|
|
||||||
echo rpm > %{buildroot}%{python3_sitelib}/pip-%{version}.dist-info/INSTALLER
|
echo rpm > %{buildroot}%{python3_sitelib}/pip-%{version}.dist-info/INSTALLER
|
||||||
%endif
|
%endif
|
||||||
%endif
|
|
||||||
|
|
||||||
%if %{without bootstrap}
|
%if %{without bootstrap}
|
||||||
mkdir -p %{buildroot}%{python_wheeldir}
|
mkdir -p %{buildroot}%{python_wheeldir}
|
||||||
%if %{with python3}
|
install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir}
|
||||||
install -p dist/%{python3_wheelname} -t %{buildroot}%{python_wheeldir}
|
|
||||||
%else
|
|
||||||
install -p dist/%{python2_wheelname} -t %{buildroot}%{python_wheeldir}
|
|
||||||
%endif
|
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
|
||||||
@ -424,11 +387,9 @@ install -p dist/%{python2_wheelname} -t %{buildroot}%{python_wheeldir}
|
|||||||
%check
|
%check
|
||||||
export PYTHONPATH=src
|
export PYTHONPATH=src
|
||||||
%if %{with python2}
|
%if %{with python2}
|
||||||
py.test-%{python2_version} -m 'not network'
|
%{__python2} -m pytest -m 'not network'
|
||||||
%endif
|
|
||||||
%if %{with python3}
|
|
||||||
py.test-%{python3_version} -m 'not network'
|
|
||||||
%endif
|
%endif
|
||||||
|
%{__python3} -m pytest -m 'not network'
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
|
||||||
@ -456,7 +417,6 @@ py.test-%{python3_version} -m 'not network'
|
|||||||
%endif
|
%endif
|
||||||
%endif # with python2
|
%endif # with python2
|
||||||
|
|
||||||
%if %{with python3}
|
|
||||||
%files -n python%{python3_pkgversion}-%{srcname}
|
%files -n python%{python3_pkgversion}-%{srcname}
|
||||||
%license LICENSE.txt
|
%license LICENSE.txt
|
||||||
%doc README.rst
|
%doc README.rst
|
||||||
@ -481,18 +441,13 @@ py.test-%{python3_version} -m 'not network'
|
|||||||
%doc README.rst
|
%doc README.rst
|
||||||
%doc docs/build/html
|
%doc docs/build/html
|
||||||
%endif # with doc
|
%endif # with doc
|
||||||
%endif # with python3
|
|
||||||
|
|
||||||
%if %{without bootstrap}
|
%if %{without bootstrap}
|
||||||
%files wheel
|
%files wheel
|
||||||
%license LICENSE.txt
|
%license LICENSE.txt
|
||||||
# we own the dir for simplicity
|
# we own the dir for simplicity
|
||||||
%dir %{python_wheeldir}/
|
%dir %{python_wheeldir}/
|
||||||
%if %{with python3}
|
%{python_wheeldir}/%{python_wheelname}
|
||||||
%{python_wheeldir}/%{python3_wheelname}
|
|
||||||
%else
|
|
||||||
%{python_wheeldir}/%{python2_wheelname}
|
|
||||||
%endif
|
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
Loading…
Reference in New Issue
Block a user