Conditionalize python2 and python3 builds to make the SRPM more portable
across releases. On RHEL > 7 and Fedora > 28, do not build for python2. On RHEL <= 7, do not build for python3.
This commit is contained in:
parent
fd1a7f123a
commit
a332a006d0
116
pyparted.spec
116
pyparted.spec
|
@ -1,10 +1,42 @@
|
||||||
%define with_python3 1
|
%if 0%{?rhel}
|
||||||
|
%if %{rhel} <= 7
|
||||||
|
# disable python3 by default
|
||||||
|
%bcond_with python3
|
||||||
|
%else
|
||||||
|
%bcond_without python3
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if %{rhel} > 7
|
||||||
|
# disable python2 by default
|
||||||
|
%bcond_with python2
|
||||||
|
%else
|
||||||
|
%bcond_without python2
|
||||||
|
%endif
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?fedora}
|
||||||
|
%if %{fedora} < 23
|
||||||
|
# disable python3 by default
|
||||||
|
%bcond_with python3
|
||||||
|
%else
|
||||||
|
%bcond_without python3
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if %{fedora} > 28
|
||||||
|
# disable python2 by default
|
||||||
|
%bcond_with python2
|
||||||
|
%else
|
||||||
|
%bcond_without python2
|
||||||
|
%endif
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%global py2dir python2-build
|
||||||
|
|
||||||
Summary: Python module for GNU parted
|
Summary: Python module for GNU parted
|
||||||
Name: pyparted
|
Name: pyparted
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Version: 3.11.0
|
Version: 3.11.0
|
||||||
Release: 13%{?dist}
|
Release: 14%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
URL: https://github.com/rhinstaller/pyparted
|
URL: https://github.com/rhinstaller/pyparted
|
||||||
|
@ -12,22 +44,27 @@ URL: https://github.com/rhinstaller/pyparted
|
||||||
Source0: https://github.com/rhinstaller/pyparted/archive/%{name}-%{version}.tar.gz
|
Source0: https://github.com/rhinstaller/pyparted/archive/%{name}-%{version}.tar.gz
|
||||||
|
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: python2-devel
|
|
||||||
BuildRequires: python2-six
|
|
||||||
%if 0%{?with_python3}
|
|
||||||
BuildRequires: python3-devel
|
|
||||||
BuildRequires: python3-six
|
|
||||||
%endif
|
|
||||||
BuildRequires: parted-devel >= 3.2-18
|
BuildRequires: parted-devel >= 3.2-18
|
||||||
BuildRequires: pkgconfig
|
BuildRequires: pkgconfig
|
||||||
BuildRequires: e2fsprogs
|
BuildRequires: e2fsprogs
|
||||||
|
|
||||||
|
%if %{with python3}
|
||||||
|
BuildRequires: python3-devel
|
||||||
|
BuildRequires: python3-six
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if %{with python2}
|
||||||
|
BuildRequires: python2-devel
|
||||||
|
BuildRequires: python2-six
|
||||||
|
%endif
|
||||||
|
|
||||||
%global _description\
|
%global _description\
|
||||||
Python module for the parted library. It is used for manipulating\
|
Python module for the parted library. It is used for manipulating\
|
||||||
partition tables.
|
partition tables.
|
||||||
|
|
||||||
%description %_description
|
%description %_description
|
||||||
|
|
||||||
|
%if %{with python2}
|
||||||
%package -n python2-pyparted
|
%package -n python2-pyparted
|
||||||
Summary: %summary
|
Summary: %summary
|
||||||
%{?python_provide:%python_provide python2-pyparted}
|
%{?python_provide:%python_provide python2-pyparted}
|
||||||
|
@ -37,8 +74,9 @@ Provides: pyparted%{?_isa} = %{epoch}:%{version}-%{release}
|
||||||
Obsoletes: pyparted < %{epoch}:%{version}-%{release}
|
Obsoletes: pyparted < %{epoch}:%{version}-%{release}
|
||||||
|
|
||||||
%description -n python2-pyparted %_description
|
%description -n python2-pyparted %_description
|
||||||
|
%endif
|
||||||
|
|
||||||
%if 0%{?with_python3}
|
%if %{with python3}
|
||||||
%package -n python3-pyparted
|
%package -n python3-pyparted
|
||||||
Summary: Python 3 module for GNU parted
|
Summary: Python 3 module for GNU parted
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
|
@ -51,46 +89,47 @@ partition tables. This package provides Python 3 bindings for parted.
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
|
||||||
%if 0%{?with_python3}
|
%if %{with python2}
|
||||||
rm -rf %{py3dir}
|
rm -rf ../%{py2dir}
|
||||||
cp -a . %{py3dir}
|
mkdir -p ../%{py2dir}
|
||||||
|
cp -a . ../%{py2dir}
|
||||||
|
mv ../%{py2dir} .
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%build
|
%build
|
||||||
PYTHON=python2 make %{?_smp_mflags}
|
%if %{with python3}
|
||||||
|
|
||||||
%if 0%{?with_python3}
|
|
||||||
pushd %{py3dir}
|
|
||||||
PYTHON=python3 make %{?_smp_mflags}
|
PYTHON=python3 make %{?_smp_mflags}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if %{with python2}
|
||||||
|
pushd %{py2dir}
|
||||||
|
PYTHON=python2 make %{?_smp_mflags}
|
||||||
popd
|
popd
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%check
|
%check
|
||||||
PYTHON=python2 make test
|
%if %{with python3}
|
||||||
|
|
||||||
%if 0%{?with_python3}
|
|
||||||
pushd %{py3dir}
|
|
||||||
PYTHON=python3 make test
|
PYTHON=python3 make test
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if %{with python2}
|
||||||
|
pushd %{py2dir}
|
||||||
|
PYTHON=python2 make test
|
||||||
popd
|
popd
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%install
|
%install
|
||||||
rm -rf %{buildroot}
|
%if %{with python3}
|
||||||
PYTHON=python2 make install DESTDIR=%{buildroot}
|
|
||||||
|
|
||||||
%if 0%{?with_python3}
|
|
||||||
pushd %{py3dir}
|
|
||||||
PYTHON=python3 make install DESTDIR=%{buildroot}
|
PYTHON=python3 make install DESTDIR=%{buildroot}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if %{with python2}
|
||||||
|
pushd %{py2dir}
|
||||||
|
PYTHON=python2 make install DESTDIR=%{buildroot}
|
||||||
popd
|
popd
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%files -n python2-pyparted
|
%if %{with python3}
|
||||||
%doc AUTHORS COPYING NEWS README TODO
|
|
||||||
%{python2_sitearch}/_ped.so
|
|
||||||
%{python2_sitearch}/parted
|
|
||||||
%{python2_sitearch}/%{name}-%{version}-*.egg-info
|
|
||||||
|
|
||||||
%if 0%{?with_python3}
|
|
||||||
%files -n python3-pyparted
|
%files -n python3-pyparted
|
||||||
%doc AUTHORS COPYING NEWS README TODO
|
%doc AUTHORS COPYING NEWS README TODO
|
||||||
%{python3_sitearch}/_ped.*.so
|
%{python3_sitearch}/_ped.*.so
|
||||||
|
@ -98,7 +137,20 @@ popd
|
||||||
%{python3_sitearch}/%{name}-%{version}-*.egg-info
|
%{python3_sitearch}/%{name}-%{version}-*.egg-info
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
%if %{with python2}
|
||||||
|
%files -n python2-pyparted
|
||||||
|
%doc AUTHORS COPYING NEWS README TODO
|
||||||
|
%{python2_sitearch}/_ped.so
|
||||||
|
%{python2_sitearch}/parted
|
||||||
|
%{python2_sitearch}/%{name}-%{version}-*.egg-info
|
||||||
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jul 25 2018 David Cantrell <dcantrell@redhat.com> - 1:3.11.0-14
|
||||||
|
- Conditionalize python2 and python3 builds to make the SRPM more portable
|
||||||
|
across releases. On RHEL > 7 and Fedora > 28, do not build for python2.
|
||||||
|
On RHEL <= 7, do not build for python3.
|
||||||
|
|
||||||
* Tue Jul 24 2018 David Cantrell <dcantrell@redhat.com> - 1:3.11.0-13
|
* Tue Jul 24 2018 David Cantrell <dcantrell@redhat.com> - 1:3.11.0-13
|
||||||
- Use 'python2' when building the Python 2.x bindings (#1605566)
|
- Use 'python2' when building the Python 2.x bindings (#1605566)
|
||||||
- BuildRequires gcc (#1605566)
|
- BuildRequires gcc (#1605566)
|
||||||
|
|
Loading…
Reference in New Issue