Switch macros to bcond's
To facilitate building the Python 2 and Python 3 modules.
This commit is contained in:
parent
e27aaa21f1
commit
a096270f29
@ -1,11 +1,12 @@
|
|||||||
%global with_python3 1
|
%bcond_with bootstrap
|
||||||
%global build_wheel 1
|
%bcond_with tests
|
||||||
%global with_tests 0
|
|
||||||
|
%bcond_without python3
|
||||||
|
|
||||||
%global srcname pip
|
%global srcname pip
|
||||||
%if 0%{?build_wheel}
|
%if %{without bootstrap}
|
||||||
%global python2_wheelname %{srcname}-%{version}-py2.py3-none-any.whl
|
%global python2_wheelname %{srcname}-%{version}-py2.py3-none-any.whl
|
||||||
%if 0%{?with_python3}
|
%if %{with python3}
|
||||||
%global python3_wheelname %python2_wheelname
|
%global python3_wheelname %python2_wheelname
|
||||||
%endif
|
%endif
|
||||||
%endif
|
%endif
|
||||||
@ -30,7 +31,7 @@ BuildArch: noarch
|
|||||||
# to get tests:
|
# to get tests:
|
||||||
# git clone https://github.com/pypa/pip && cd pip
|
# git clone https://github.com/pypa/pip && cd pip
|
||||||
# git checkout 9.0.1 && tar -czvf ../pip-9.0.1-tests.tar.gz tests/
|
# git checkout 9.0.1 && tar -czvf ../pip-9.0.1-tests.tar.gz tests/
|
||||||
%if 0%{?with_tests}
|
%if %{with tests}
|
||||||
Source1: pip-9.0.1-tests.tar.gz
|
Source1: pip-9.0.1-tests.tar.gz
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
@ -55,7 +56,7 @@ Summary: A tool for installing and managing Python 2 packages
|
|||||||
Group: Development/Libraries
|
Group: Development/Libraries
|
||||||
BuildRequires: python2-devel
|
BuildRequires: python2-devel
|
||||||
BuildRequires: python-setuptools
|
BuildRequires: python-setuptools
|
||||||
%if 0%{?with_tests}
|
%if %{with tests}
|
||||||
BuildRequires: git
|
BuildRequires: git
|
||||||
BuildRequires: bzr
|
BuildRequires: bzr
|
||||||
BuildRequires: python-mock
|
BuildRequires: python-mock
|
||||||
@ -66,7 +67,7 @@ BuildRequires: python-pytest-capturelog
|
|||||||
BuildRequires: python-scripttest
|
BuildRequires: python-scripttest
|
||||||
BuildRequires: python-virtualenv
|
BuildRequires: python-virtualenv
|
||||||
%endif
|
%endif
|
||||||
%if 0%{?build_wheel}
|
%if %{without bootstrap}
|
||||||
BuildRequires: python2-pip
|
BuildRequires: python2-pip
|
||||||
BuildRequires: python-wheel
|
BuildRequires: python-wheel
|
||||||
%endif
|
%endif
|
||||||
@ -80,7 +81,7 @@ written in Python. Many packages can be found in the Python Package Index
|
|||||||
Packages" or "Pip Installs Python".
|
Packages" or "Pip Installs Python".
|
||||||
|
|
||||||
|
|
||||||
%if 0%{?with_python3}
|
%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
|
||||||
@ -88,7 +89,7 @@ Group: Development/Libraries
|
|||||||
BuildRequires: python%{python3_pkgversion}-devel
|
BuildRequires: python%{python3_pkgversion}-devel
|
||||||
BuildRequires: python%{python3_pkgversion}-setuptools
|
BuildRequires: python%{python3_pkgversion}-setuptools
|
||||||
BuildRequires: bash-completion
|
BuildRequires: bash-completion
|
||||||
%if 0%{?with_tests}
|
%if %{with tests}
|
||||||
BuildRequires: python%{python3_pkgversion}-mock
|
BuildRequires: python%{python3_pkgversion}-mock
|
||||||
BuildRequires: python%{python3_pkgversion}-pytest
|
BuildRequires: python%{python3_pkgversion}-pytest
|
||||||
BuildRequires: python%{python3_pkgversion}-pretend
|
BuildRequires: python%{python3_pkgversion}-pretend
|
||||||
@ -97,7 +98,7 @@ BuildRequires: python%{python3_pkgversion}-pytest-capturelog
|
|||||||
BuildRequires: python%{python3_pkgversion}-scripttest
|
BuildRequires: python%{python3_pkgversion}-scripttest
|
||||||
BuildRequires: python%{python3_pkgversion}-virtualenv
|
BuildRequires: python%{python3_pkgversion}-virtualenv
|
||||||
%endif
|
%endif
|
||||||
%if 0%{?build_wheel}
|
%if %{without bootstrap}
|
||||||
BuildRequires: python%{python3_pkgversion}-pip
|
BuildRequires: python%{python3_pkgversion}-pip
|
||||||
BuildRequires: python%{python3_pkgversion}-wheel
|
BuildRequires: python%{python3_pkgversion}-wheel
|
||||||
%endif
|
%endif
|
||||||
@ -110,12 +111,12 @@ written in Python. Many packages can be found in the Python Package Index
|
|||||||
(PyPI). pip is a recursive acronym that can stand for either "Pip Installs
|
(PyPI). pip is a recursive acronym that can stand for either "Pip Installs
|
||||||
Packages" or "Pip Installs Python".
|
Packages" or "Pip Installs Python".
|
||||||
|
|
||||||
%endif # with_python3
|
%endif # with python3
|
||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n %{srcname}-%{version}
|
%setup -q -n %{srcname}-%{version}
|
||||||
%if 0%{?with_tests}
|
%if %{with tests}
|
||||||
tar -xf %{SOURCE1}
|
tar -xf %{SOURCE1}
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
@ -126,34 +127,35 @@ sed -i '1d' pip/__init__.py
|
|||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%if 0%{?build_wheel}
|
%if %{without bootstrap}
|
||||||
%py2_build_wheel
|
%py2_build_wheel
|
||||||
%else
|
%else
|
||||||
%py2_build
|
%py2_build
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{?with_python3}
|
%if %{with python3}
|
||||||
%if 0%{?build_wheel}
|
%if %{without bootstrap}
|
||||||
%py3_build_wheel
|
%py3_build_wheel
|
||||||
%else
|
%else
|
||||||
%py3_build
|
%py3_build
|
||||||
%endif
|
%endif
|
||||||
%endif # with_python3
|
%endif # with python3
|
||||||
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%if 0%{?with_python3}
|
%if %{with python3}
|
||||||
%if 0%{?build_wheel}
|
%if %{without bootstrap}
|
||||||
%py3_install_wheel %{python3_wheelname}
|
%py3_install_wheel %{python3_wheelname}
|
||||||
# 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)
|
|
||||||
rm %{buildroot}%{_bindir}/pip
|
|
||||||
%else
|
%else
|
||||||
%py3_install
|
%py3_install
|
||||||
%endif
|
%endif
|
||||||
%endif # with_python3
|
|
||||||
|
|
||||||
%if 0%{?build_wheel}
|
# 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)
|
||||||
|
rm %{buildroot}%{_bindir}/pip
|
||||||
|
%endif # with python3
|
||||||
|
|
||||||
|
%if %{without bootstrap}
|
||||||
%py2_install_wheel %{python2_wheelname}
|
%py2_install_wheel %{python2_wheelname}
|
||||||
%else
|
%else
|
||||||
%py2_install
|
%py2_install
|
||||||
@ -163,7 +165,7 @@ mkdir -p %{buildroot}%{bashcompdir}
|
|||||||
PYTHONPATH=%{buildroot}%{python_sitelib} \
|
PYTHONPATH=%{buildroot}%{python_sitelib} \
|
||||||
%{buildroot}%{_bindir}/pip completion --bash \
|
%{buildroot}%{_bindir}/pip completion --bash \
|
||||||
> %{buildroot}%{bashcompdir}/pip
|
> %{buildroot}%{bashcompdir}/pip
|
||||||
%if 0%{?with_python3}
|
%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
|
||||||
@ -179,7 +181,7 @@ for pip in %{buildroot}%{_bindir}/pip*; do
|
|||||||
ln -s pip %{buildroot}%{bashcompdir}/$pip
|
ln -s pip %{buildroot}%{bashcompdir}/$pip
|
||||||
%endif
|
%endif
|
||||||
;;
|
;;
|
||||||
%if 0%{?with_python3}
|
%if %{with python3}
|
||||||
pip3?*)
|
pip3?*)
|
||||||
pips3="$pips3 $pip"
|
pips3="$pips3 $pip"
|
||||||
%if 0%{?bashcomp2}
|
%if 0%{?bashcomp2}
|
||||||
@ -189,7 +191,7 @@ for pip in %{buildroot}%{_bindir}/pip*; do
|
|||||||
%endif
|
%endif
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
%if 0%{?with_python3}
|
%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
|
||||||
@ -204,7 +206,7 @@ ln -s ./pip-%{python2_version} %{buildroot}%{_bindir}/pip-2
|
|||||||
ln -s ./pip-%{python3_version} %{buildroot}%{_bindir}/pip-3
|
ln -s ./pip-%{python3_version} %{buildroot}%{_bindir}/pip-3
|
||||||
|
|
||||||
|
|
||||||
%if 0%{?with_tests}
|
%if %{with tests}
|
||||||
%check
|
%check
|
||||||
py.test -m 'not network'
|
py.test -m 'not network'
|
||||||
py.test-%{python3_version} -m 'not network'
|
py.test-%{python3_version} -m 'not network'
|
||||||
@ -221,14 +223,14 @@ py.test-%{python3_version} -m 'not network'
|
|||||||
%{_bindir}/pip-%{python2_version}
|
%{_bindir}/pip-%{python2_version}
|
||||||
%{python_sitelib}/pip*
|
%{python_sitelib}/pip*
|
||||||
%{bashcompdir}
|
%{bashcompdir}
|
||||||
%if 0%{?with_python3}
|
%if %{with python3}
|
||||||
%exclude %{bashcompdir}/pip3*
|
%exclude %{bashcompdir}/pip3*
|
||||||
%endif
|
%endif
|
||||||
%if 0%{?bashcomp2}
|
%if 0%{?bashcomp2}
|
||||||
%dir %(dirname %{bashcompdir})
|
%dir %(dirname %{bashcompdir})
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{?with_python3}
|
%if %{with python3}
|
||||||
%files -n python%{python3_pkgversion}-%{srcname}
|
%files -n python%{python3_pkgversion}-%{srcname}
|
||||||
%license LICENSE.txt
|
%license LICENSE.txt
|
||||||
%doc README.rst docs
|
%doc README.rst docs
|
||||||
@ -242,7 +244,7 @@ py.test-%{python3_version} -m 'not network'
|
|||||||
%if 0%{?bashcomp2}
|
%if 0%{?bashcomp2}
|
||||||
%dir %(dirname %{bashcompdir})
|
%dir %(dirname %{bashcompdir})
|
||||||
%endif
|
%endif
|
||||||
%endif # with_python3
|
%endif # with python3
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 9.0.1-11
|
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 9.0.1-11
|
||||||
|
Loading…
Reference in New Issue
Block a user