remove python2

This commit is contained in:
liquor 2020-08-06 11:28:47 +08:00
parent 7e94419d1b
commit 1129dcbbd1

View File

@ -18,12 +18,6 @@
%bcond_without drpm
%endif
%if 0%{?openEuler} || 0%{?fedora} > 29 || 0%{?rhel} > 7
%bcond_with python2
%else
%bcond_without python2
%endif
%if 0%{?openEuler} || 0%{?rhel} || 0%{?fedora} < 29
%bcond_with zchunk
%else
@ -39,7 +33,7 @@
Summary: Creates a common metadata repository
Name: createrepo_c
Version: 0.16.0
Release: 1
Release: 2
License: GPLv2+
URL: https://github.com/rpm-software-management/createrepo_c
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
@ -99,24 +93,6 @@ These development files are for easy manipulation with a repodata.
%package_help
%if %{with python2}
%package -n python2-%{name}
Summary: Python bindings for the createrepo_c library
%{?python_provide:%python_provide python2-%{name}}
BuildRequires: python2-devel
BuildRequires: python2-nose
%if 0%{?openEuler} == 0 && 0%{?rhel} && 0%{?rhel} <= 7
BuildRequires: python-sphinx
%else
BuildRequires: python2-sphinx
%endif
Requires: %{name}-libs = %{version}-%{release}
Provides: python-%{name}%{?_isa} = %{version}-%{release}
%description -n python2-%{name}
Python bindings for the createrepo_c library.
%endif
%if %{with python3}
%package -n python3-%{name}
Summary: Python 3 bindings for the createrepo_c library
@ -133,75 +109,27 @@ Python 3 bindings for the createrepo_c library.
%prep
%autosetup -p1
%if %{with python2}
mkdir build-py2
%endif
%if %{with python3}
mkdir build-py3
%endif
%build
# Build createrepo_c with Python 2
%if %{with python2}
pushd build-py2
%cmake .. -DPYTHON_DESIRED:FILEPATH=%{__python2} %{!?with_zchunk:-DWITH_ZCHUNK=OFF} %{!?with_libmodulemd:-DWITH_LIBMODULEMD=OFF}
make %{?_smp_mflags} RPM_OPT_FLAGS="%{optflags}"
%if %{without python3}
# Build C documentation
make doc-c
%endif
popd
%endif
# Build createrepo_c with Pyhon 3
%if %{with python3}
pushd build-py3
%cmake .. -DPYTHON_DESIRED:FILEPATH=%{__python3} %{!?with_zchunk:-DWITH_ZCHUNK=OFF} %{!?with_libmodulemd:-DWITH_LIBMODULEMD=OFF}
make %{?_smp_mflags} RPM_OPT_FLAGS="%{optflags}"
# Build C documentation
make doc-c
popd
%endif
%cmake -DPYTHON_DESIRED:FILEPATH=%{__python3} %{!?with_zchunk:-DWITH_ZCHUNK=OFF} %{!?with_libmodulemd:-DWITH_LIBMODULEMD=OFF}
make %{?_smp_mflags} RPM_OPT_FLAGS="%{optflags}"
# Build C documentation
make doc-c
%check
%if 0%{?openEuler} == 0 && %{with python2}
pushd build-py2
%if %{without python3}
# Compile C tests
make tests
%endif
# Run Python 2 tests
make ARGS="-V" test
popd
%endif
# Run Python 3 tests
%if %{with python3}
pushd build-py3
# Compile C tests
make tests
# Compile C tests
make tests
# Run Python 3 tests
make ARGS="-V" test
popd
# Run Python 3 tests
make ARGS="-V" test
%endif
%install
%if %{with python2}
pushd build-py2
# Install createrepo_c with Python 2
make install DESTDIR=%{buildroot}
popd
%endif
%if %{with python3}
pushd build-py3
# Install createrepo_c with Python 3
make install DESTDIR=%{buildroot}
popd
%endif
# Install createrepo_c with Python 3
make install DESTDIR=%{buildroot}
%if 0%{?openEuler} || 0%{?fedora} || 0%{?rhel} > 7
ln -sr %{buildroot}%{_bindir}/createrepo_c %{buildroot}%{_bindir}/createrepo
@ -238,22 +166,12 @@ ln -sr %{buildroot}%{_bindir}/modifyrepo_c %{buildroot}%{_bindir}/modifyrepo
%{_includedir}/%{name}/
%files help
%if %{with python3}
%doc build-py3/doc/html
%else
%doc build-py2/doc/html
%endif
%doc doc/html
%{_mandir}/man8/createrepo_c.8*
%{_mandir}/man8/mergerepo_c.8*
%{_mandir}/man8/modifyrepo_c.8*
%{_mandir}/man8/sqliterepo_c.8*
%if %{with python2}
%files -n python2-%{name}
%{python2_sitearch}/%{name}/
%{python2_sitearch}/%{name}-%{version}-py%{python2_version}.egg-info
%endif
%if %{with python3}
%files -n python3-%{name}
%{python3_sitearch}/%{name}/
@ -261,6 +179,9 @@ ln -sr %{buildroot}%{_bindir}/modifyrepo_c %{buildroot}%{_bindir}/modifyrepo
%endif
%changelog
* Sat Jul 25 2020 Liquor <lirui130@huawei.com> - 0.16.0-2
- remove python2
* Sat Jul 25 2020 Liquor <lirui130@huawei.com> - 0.16.0-1
- update 0.16.0