Make spec file python2 compatible

This commit is contained in:
Carl George 2021-03-15 15:40:31 -05:00
parent ed14055b6d
commit 1e8da7bd1e

View file

@ -1,3 +1,13 @@
# In order to use unversioned python macros in the spec file, we need to
# explicitly define %%__python. It is already defined on el7.
%if %{undefined el7}
%if %{defined el8}
%global __python %{_libexecdir}/platform-python
%else
%global __python %{python3}
%endif
%endif
Name: centpkg Name: centpkg
Version: %{!?devrel:0.4.6}%{?devrel:0.4.7} Version: %{!?devrel:0.4.6}%{?devrel:0.4.7}
Release: %{?devrel:0.%{devrel}%{?devsnap:.%{devsnap}}.}1%{?dist} Release: %{?devrel:0.%{devrel}%{?devsnap:.%{devsnap}}.}1%{?dist}
@ -7,11 +17,12 @@ URL: https://git.centos.org/centos/centpkg
Source0: https://git.centos.org/centos/centpkg/archive/%{version}/centpkg-%{version}.tar.gz Source0: https://git.centos.org/centos/centpkg/archive/%{version}/centpkg-%{version}.tar.gz
BuildArch: noarch BuildArch: noarch
BuildRequires: python3-devel %if %{defined el7}
%if 0%{?rhel} > 0 && 0%{?rhel} < 8 BuildRequires: python-devel
BuildRequires: python-setuptools BuildRequires: python-setuptools
%else %else
BuildRequires: %{py3_dist setuptools} BuildRequires: python3-devel
BuildRequires: python3-setuptools
%endif %endif
%description %description
@ -31,11 +42,11 @@ Provides the centpkg-sig command for working with dist-git.
%build %build
%py3_build %py_build
%install %install
%py3_install %py_install
%files %files
@ -43,7 +54,8 @@ Provides the centpkg-sig command for working with dist-git.
%doc README.md %doc README.md
%config(noreplace) %{_sysconfdir}/rpkg/centpkg.conf %config(noreplace) %{_sysconfdir}/rpkg/centpkg.conf
%{_bindir}/%{name} %{_bindir}/%{name}
%{python3_sitelib}/%{name}* %{python_sitelib}/%{name}
%{python_sitelib}/%{name}-%{version}-py%{python_version}.egg-info
%files sig %files sig