Switch macros to bcond's and make Python 2 optional
To facilitate building the Python 2 and Python 3 modules.
This commit is contained in:
parent
2889c61d29
commit
61ba8589f4
@ -1,10 +1,15 @@
|
||||
# Note that the only function of bootstrap is that it disables the test suite:
|
||||
# bcond_with bootstrap = tests enabled
|
||||
%bcond_with bootstrap
|
||||
|
||||
%bcond_without python2
|
||||
%bcond_without python3
|
||||
|
||||
%global pypi_name wheel
|
||||
|
||||
Name: python-%{pypi_name}
|
||||
Version: 0.30.0a0
|
||||
Release: 7%{?dist}
|
||||
Release: 8%{?dist}
|
||||
Summary: A built-package format for Python
|
||||
|
||||
License: MIT
|
||||
@ -30,6 +35,7 @@ compatible install in a way that is very close to the on-disk format.
|
||||
|
||||
%description %{_description}
|
||||
|
||||
%if %{with python2}
|
||||
%package -n python2-%{pypi_name}
|
||||
Summary: %{summary}
|
||||
BuildRequires: python2-devel
|
||||
@ -45,7 +51,10 @@ BuildRequires: python-jsonschema
|
||||
%description -n python2-%{pypi_name} %{_description}
|
||||
|
||||
Python 2 version.
|
||||
%endif
|
||||
|
||||
|
||||
%if %{with python3}
|
||||
%package -n python3-%{pypi_name}
|
||||
Summary: %{summary}
|
||||
BuildRequires: python3-devel
|
||||
@ -61,6 +70,8 @@ BuildRequires: python3-jsonschema
|
||||
%description -n python3-%{pypi_name} %{_description}
|
||||
|
||||
Python 3 version.
|
||||
%endif
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n %{pypi_name}-%{version}
|
||||
@ -68,27 +79,42 @@ Python 3 version.
|
||||
sed -ie '1d' %{pypi_name}/{egg2wheel,wininst2wheel}.py
|
||||
%patch0 -p1
|
||||
|
||||
|
||||
%build
|
||||
%if %{with python2}
|
||||
%py2_build
|
||||
%endif
|
||||
%if %{with python3}
|
||||
%py3_build
|
||||
%endif
|
||||
|
||||
|
||||
%install
|
||||
%py2_install
|
||||
mv %{buildroot}%{_bindir}/%{pypi_name}{,-%{python2_version}}
|
||||
ln -s %{pypi_name}-%{python2_version} %{buildroot}%{_bindir}/%{pypi_name}-2
|
||||
%if %{with python3}
|
||||
%py3_install
|
||||
mv %{buildroot}%{_bindir}/%{pypi_name}{,-%{python3_version}}
|
||||
ln -s %{pypi_name}-%{python3_version} %{buildroot}%{_bindir}/%{pypi_name}-3
|
||||
%endif
|
||||
|
||||
%if %{with python2}
|
||||
%py2_install
|
||||
mv %{buildroot}%{_bindir}/%{pypi_name}{,-%{python2_version}}
|
||||
ln -s %{pypi_name}-%{python2_version} %{buildroot}%{_bindir}/%{pypi_name}-2
|
||||
ln -s %{pypi_name}-2 %{buildroot}%{_bindir}/%{pypi_name}
|
||||
%endif
|
||||
|
||||
%if ! %{with bootstrap}
|
||||
%check
|
||||
rm setup.cfg
|
||||
%if %{with python2}
|
||||
PYTHONPATH=%{buildroot}%{python2_sitelib} py.test-2 -v --ignore build
|
||||
%endif
|
||||
%if %{with python3}
|
||||
PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-3 -v --ignore build
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%if %{with python2}
|
||||
%files -n python2-%{pypi_name}
|
||||
%license LICENSE.txt
|
||||
%doc CHANGES.txt README.txt
|
||||
@ -97,7 +123,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-3 -v --ignore build
|
||||
%{_bindir}/%{pypi_name}-%{python2_version}
|
||||
%{python2_sitelib}/%{pypi_name}*
|
||||
%exclude %{python2_sitelib}/%{pypi_name}/test
|
||||
%endif
|
||||
|
||||
%if %{with python3}
|
||||
%files -n python3-%{pypi_name}
|
||||
%license LICENSE.txt
|
||||
%doc CHANGES.txt README.txt
|
||||
@ -105,8 +133,13 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-3 -v --ignore build
|
||||
%{_bindir}/%{pypi_name}-%{python3_version}
|
||||
%{python3_sitelib}/%{pypi_name}*
|
||||
%exclude %{python3_sitelib}/%{pypi_name}/test
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Aug 29 2017 Tomas Orsava <torsava@redhat.com> - 0.30.0a0-8
|
||||
- Switch macros to bcond's and make Python 2 optional to facilitate building
|
||||
the Python 2 and Python 3 modules
|
||||
|
||||
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.30.0a0-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user