diff --git a/python-fastcache.spec b/python-fastcache.spec index e813520..65a7f62 100644 --- a/python-fastcache.spec +++ b/python-fastcache.spec @@ -2,16 +2,16 @@ %global with_py3 1 %endif -%global pkgname fastcache +%global srcname fastcache -Name: python-%{pkgname} +Name: python-%{srcname} Version: 1.0.2 Release: 4%{?dist} Summary: C implementation of python3 lru_cache License: MIT -URL: https://github.com/pbrady/%{pkgname} -Source0: https://github.com/pbrady/%{pkgname}/archive/v%{version}.tar.gz +URL: https://github.com/pbrady/%{srcname} +Source0: https://github.com/pbrady/%{srcname}/archive/v%{version}.tar.gz BuildRequires: pycmd BuildRequires: pytest @@ -25,15 +25,19 @@ BuildRequires: python3-devel BuildRequires: python3-setuptools %endif +%{?python_provide:%python_provide python2-%{srcname}} + %description This package contains a C implementation of the python 3 lru_cache. It passes all tests in the standard library for functools.lru_cache. %if 0%{?with_py3} -%package -n python3-%{pkgname} +%package -n python3-%{srcname} Summary: C implementation of python3 lru_cache -%description -n python3-%{pkgname} +%{?python_provide:%python_provide python3-%{srcname}} + +%description -n python3-%{srcname} This package contains a C implementation of the python 3 lru_cache. It passes all tests in the standard library for functools.lru_cache. %endif @@ -43,40 +47,40 @@ passes all tests in the standard library for functools.lru_cache. %if 0%{?with_py3} # Prepare for a python3 build -cp -a %{pkgname}-%{version} python3-%{pkgname}-%{version} +cp -a %{srcname}-%{version} python3-%{srcname}-%{version} %endif %build # Python 2 build -pushd %{pkgname}-%{version} -%{__python2} setup.py build --define=WITH_THREAD +pushd %{srcname}-%{version} +%py2_build "--define=WITH_THREAD" popd %if 0%{?with_py3} # Python 3 build -pushd python3-%{pkgname}-%{version} -%{__python3} setup.py build --define=WITH_THREAD +pushd python3-%{srcname}-%{version} +%py3_build "--define=WITH_THREAD" popd %endif %install # Python 2 install -pushd %{pkgname}-%{version} -%{__python2} setup.py install -O1 --skip-build --root %{buildroot} -chmod 0755 %{buildroot}%{python2_sitearch}/%{pkgname}/*.so +pushd %{srcname}-%{version} +%{py2_install} +chmod 0755 %{buildroot}%{python2_sitearch}/%{srcname}/*.so popd %if 0%{?with_py3} # Python 3 install -pushd python3-%{pkgname}-%{version} -%{__python3} setup.py install -O1 --skip-build --root %{buildroot} -chmod 0755 %{buildroot}%{python3_sitearch}/%{pkgname}/*.so +pushd python3-%{srcname}-%{version} +%{py3_install} +chmod 0755 %{buildroot}%{python3_sitearch}/%{srcname}/*.so popd %endif %check # Python 2 tests -pushd %{pkgname}-%{version} +pushd %{srcname}-%{version} py.cleanup-%{python2_version} -p export PYTHONPATH=build/lib.linux-%{_arch}-%{python2_version}/fastcache/tests py.test-%{python2_version} -v --ignore=fastcache/tests @@ -84,7 +88,7 @@ popd %if 0%{?with_py3} # Python 3 tests -pushd python3-%{pkgname}-%{version} +pushd python3-%{srcname}-%{version} py.cleanup-%{python3_version} -p export PYTHONPATH=build/lib.linux-%{_arch}-%{python3_version}/fastcache/tests py.test-%{python3_version} -v --ignore=fastcache/tests @@ -92,19 +96,19 @@ popd %endif %files -%doc %{pkgname}-%{version}/CHANGELOG %{pkgname}-%{version}/README.md -%license %{pkgname}-%{version}/LICENSE -%{python2_sitearch}/%{pkgname}/ -%{python2_sitearch}/%{pkgname}*.egg-info/ -%exclude %{python2_sitearch}/%{pkgname}/tests +%doc %{srcname}-%{version}/CHANGELOG %{srcname}-%{version}/README.md +%license %{srcname}-%{version}/LICENSE +%{python2_sitearch}/%{srcname}/ +%{python2_sitearch}/%{srcname}*.egg-info/ +%exclude %{python2_sitearch}/%{srcname}/tests %if 0%{?with_py3} -%files -n python3-%{pkgname} -%doc %{pkgname}-%{version}/CHANGELOG %{pkgname}-%{version}/README.md -%license %{pkgname}-%{version}/LICENSE -%{python3_sitearch}/%{pkgname}/ -%{python3_sitearch}/%{pkgname}*.egg-info/ -%exclude %{python3_sitearch}/%{pkgname}/tests +%files -n python3-%{srcname} +%doc %{srcname}-%{version}/CHANGELOG %{srcname}-%{version}/README.md +%license %{srcname}-%{version}/LICENSE +%{python3_sitearch}/%{srcname}/ +%{python3_sitearch}/%{srcname}*.egg-info/ +%exclude %{python3_sitearch}/%{srcname}/tests %endif %changelog