Conditionalize out python2 subpackage builds on Fedora releases

after 28 and EL releases after 7
This commit is contained in:
David Cantrell 2018-04-02 12:52:58 -04:00
parent 4025591235
commit fd56619619

View File

@ -1,6 +1,12 @@
%if 0%{?rhel} > 7 || 0%{?fedora} > 28
%bcond_with python2
%else
%bcond_without python2
%endif
Name: pykickstart Name: pykickstart
Version: 3.12 Version: 3.12
Release: 1%{?dist} Release: 2%{?dist}
License: GPLv2 and MIT License: GPLv2 and MIT
Group: System Environment/Libraries Group: System Environment/Libraries
Summary: Python utilities for manipulating kickstart files. Summary: Python utilities for manipulating kickstart files.
@ -13,12 +19,14 @@ Source0: %{name}-%{version}.tar.gz
BuildArch: noarch BuildArch: noarch
BuildRequires: gettext BuildRequires: gettext
%if %{with python2}
BuildRequires: python2-coverage BuildRequires: python2-coverage
BuildRequires: python2-devel BuildRequires: python2-devel
BuildRequires: python2-nose BuildRequires: python2-nose
BuildRequires: python2-ordered-set BuildRequires: python2-ordered-set
BuildRequires: python2-setuptools BuildRequires: python2-setuptools
BuildRequires: python2-requests BuildRequires: python2-requests
%endif
BuildRequires: python3-coverage BuildRequires: python3-coverage
BuildRequires: python3-devel BuildRequires: python3-devel
@ -36,6 +44,7 @@ Python utilities for manipulating kickstart files. The Python 2 and 3 libraries
can be found in the packages python-kickstart and python3-kickstart can be found in the packages python-kickstart and python3-kickstart
respectively. respectively.
%if %{with python2}
# Python 2 library # Python 2 library
%package -n python2-kickstart %package -n python2-kickstart
%{?python_provide:%python_provide python2-kickstart} %{?python_provide:%python_provide python2-kickstart}
@ -48,6 +57,7 @@ Requires: python2-ordered-set
%description -n python2-kickstart %description -n python2-kickstart
Python 2 library for manipulating kickstart files. The binaries are found in Python 2 library for manipulating kickstart files. The binaries are found in
the pykickstart package. the pykickstart package.
%endif
# Python 3 library # Python 3 library
%package -n python3-kickstart %package -n python3-kickstart
@ -63,29 +73,34 @@ the pykickstart package.
%prep %prep
%setup -q %setup -q
%if %{with python2}
rm -rf %{py3dir} rm -rf %{py3dir}
mkdir %{py3dir} mkdir %{py3dir}
cp -a . %{py3dir} cp -a . %{py3dir}
%endif
%build %build
%if %{with python2}
make PYTHON=%{__python2} make PYTHON=%{__python2}
make -C %{py3dir} PYTHON=%{__python3}
pushd %{py3dir} %else
make PYTHON=%{__python3} make PYTHON=%{__python3}
popd %endif
%install %install
rm -rf %{buildroot} %if %{with python2}
make PYTHON=%{__python2} DESTDIR=%{buildroot} install make PYTHON=%{__python2} DESTDIR=%{buildroot} install
make -C %{py3dir} PYTHON=%{__python3} DESTDIR=%{buildroot} install
pushd %{py3dir} %else
make PYTHON=%{__python3} DESTDIR=%{buildroot} install make PYTHON=%{__python3} DESTDIR=%{buildroot} install
popd %endif
%check %check
pushd %{py3dir} %if %{with python2}
make -C %{py3dir} PYTHON=%{__python3} test
%else
make PYTHON=%{__python3} test make PYTHON=%{__python3} test
popd %endif
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
@ -98,6 +113,7 @@ popd
%{_bindir}/ksshell %{_bindir}/ksshell
%{_mandir}/man1/* %{_mandir}/man1/*
%if %{with python2}
%files -n python2-kickstart %files -n python2-kickstart
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc docs/2to3 %doc docs/2to3
@ -108,6 +124,7 @@ popd
%{python2_sitelib}/pykickstart/commands/ %{python2_sitelib}/pykickstart/commands/
%{python2_sitelib}/pykickstart/handlers/ %{python2_sitelib}/pykickstart/handlers/
%{python2_sitelib}/pykickstart/locale/ %{python2_sitelib}/pykickstart/locale/
%endif
%files -n python3-kickstart %files -n python3-kickstart
%defattr(-,root,root,-) %defattr(-,root,root,-)
@ -121,6 +138,10 @@ popd
%{python3_sitelib}/pykickstart/locale/ %{python3_sitelib}/pykickstart/locale/
%changelog %changelog
* Mon Apr 02 2018 David Cantrell <dcantrell@redhat.com - 3.12-2
- Conditionalize out python2 subpackage builds on Fedora releases
after 28 and EL releases after 7
* Mon Feb 19 2018 Chris Lumens <clumens@redhat.com> - 3.12-1 * Mon Feb 19 2018 Chris Lumens <clumens@redhat.com> - 3.12-1
- Sync spec file back up. (clumens) - Sync spec file back up. (clumens)
- Don't use deprecated formatErrorMsg (vponcova) - Don't use deprecated formatErrorMsg (vponcova)