Jerry James 0e745c5
%if 0%{?fedora} || 0%{?rhel} >= 8
Jerry James 0e745c5
%global with_py3 1
Jerry James 0e745c5
%endif
Jerry James 0e745c5
0954328
%global srcname fastcache
Jerry James 0e745c5
0954328
Name:           python-%{srcname}
Jerry James 0e745c5
Version:        1.0.2
c3016da
Release:        12%{?dist}
Jerry James 0e745c5
Summary:        C implementation of python3 lru_cache
Jerry James 0e745c5
Jerry James 0e745c5
License:        MIT
0954328
URL:            https://github.com/pbrady/%{srcname}
0954328
Source0:        https://github.com/pbrady/%{srcname}/archive/v%{version}.tar.gz
Jerry James 0e745c5
85fd2d5
BuildRequires:  gcc
Jerry James 0e745c5
BuildRequires:  python2-devel
85fd2d5
BuildRequires:  pycmd
85fd2d5
BuildRequires:  python2-pytest
85fd2d5
BuildRequires:  python2-setuptools
Jerry James 0e745c5
Jerry James 0e745c5
%if 0%{?with_py3}
85fd2d5
BuildRequires:  python%{python3_pkgversion}-devel
Orion Poplawski c4b6a96
BuildRequires:  python%{python3_pkgversion}-pycmd
Orion Poplawski c4b6a96
BuildRequires:  python%{python3_pkgversion}-pytest
Orion Poplawski c4b6a96
BuildRequires:  python%{python3_pkgversion}-setuptools
Jerry James 0e745c5
%endif
Jerry James 0e745c5
1d692c3
%description
1d692c3
This package contains a C implementation of the python 3 lru_cache.  It
1d692c3
passes all tests in the standard library for functools.lru_cache.
1d692c3
1d692c3
%package -n     python2-%{srcname}
1d692c3
Summary:        C implementation of python3 lru_cache
1d692c3
0954328
%{?python_provide:%python_provide python2-%{srcname}}
0954328
1d692c3
%description -n python2-%{srcname}
Jerry James 0e745c5
This package contains a C implementation of the python 3 lru_cache.  It
Jerry James 0e745c5
passes all tests in the standard library for functools.lru_cache.
Jerry James 0e745c5
Jerry James 0e745c5
%if 0%{?with_py3}
Orion Poplawski c4b6a96
%package -n     python%{python3_pkgversion}-%{srcname}
Jerry James 0e745c5
Summary:        C implementation of python3 lru_cache
Jerry James 0e745c5
Orion Poplawski c4b6a96
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
0954328
Orion Poplawski c4b6a96
%description -n python%{python3_pkgversion}-%{srcname}
Jerry James 0e745c5
This package contains a C implementation of the python 3 lru_cache.  It
Jerry James 0e745c5
passes all tests in the standard library for functools.lru_cache.
Jerry James 0e745c5
%endif
Jerry James 0e745c5
Jerry James 0e745c5
%prep
Orion Poplawski c4b6a96
%setup -q -n %{srcname}-%{version}
Jerry James 0e745c5
Jerry James 0e745c5
%build
Jerry James 0e745c5
# Python 2 build
0954328
%py2_build "--define=WITH_THREAD"
Jerry James 0e745c5
Jerry James 0e745c5
%if 0%{?with_py3}
Jerry James 0e745c5
# Python 3 build
0954328
%py3_build "--define=WITH_THREAD"
Jerry James 0e745c5
%endif
Jerry James 0e745c5
Jerry James 0e745c5
%install
Jerry James 0e745c5
# Python 2 install
1d692c3
%py2_install
0954328
chmod 0755 %{buildroot}%{python2_sitearch}/%{srcname}/*.so
Jerry James 0e745c5
Jerry James 0e745c5
%if 0%{?with_py3}
Jerry James 0e745c5
# Python 3 install
1d692c3
%py3_install
0954328
chmod 0755 %{buildroot}%{python3_sitearch}/%{srcname}/*.so
Jerry James 0e745c5
%endif
Jerry James 0e745c5
Jerry James 0e745c5
%check
Jerry James 0e745c5
# Python 2 tests
Orion Poplawski c4b6a96
export PYTHONPATH=%{buildroot}%{python2_sitearch}
Orion Poplawski c4b6a96
mkdir -p empty
Orion Poplawski c4b6a96
cd empty
Orion Poplawski c4b6a96
%{__python2} << EOF
Orion Poplawski c4b6a96
import fastcache
Orion Poplawski c4b6a96
if not fastcache.test():
Orion Poplawski c4b6a96
    raise Exception('Tests failed')
Orion Poplawski c4b6a96
EOF
Orion Poplawski c4b6a96
cd -
Jerry James 0e745c5
Jerry James 0e745c5
%if 0%{?with_py3}
Jerry James 0e745c5
# Python 3 tests
Orion Poplawski c4b6a96
export PYTHONPATH=%{buildroot}%{python3_sitearch}
Orion Poplawski c4b6a96
rm -rf emtpy
Orion Poplawski c4b6a96
mkdir -p empty
Orion Poplawski c4b6a96
cd empty
Orion Poplawski c4b6a96
%{__python3} << EOF
Orion Poplawski c4b6a96
import fastcache
Orion Poplawski c4b6a96
if not fastcache.test():
Orion Poplawski c4b6a96
    raise Exception('Tests failed')
Orion Poplawski c4b6a96
EOF
Orion Poplawski c4b6a96
cd -
Jerry James 0e745c5
%endif
Jerry James 0e745c5
1d692c3
%files -n python2-%{srcname}
Orion Poplawski c4b6a96
%doc CHANGELOG README.md
Orion Poplawski c4b6a96
%license LICENSE
0954328
%{python2_sitearch}/%{srcname}/
0954328
%{python2_sitearch}/%{srcname}*.egg-info/
0954328
%exclude %{python2_sitearch}/%{srcname}/tests
Jerry James 0e745c5
Jerry James 0e745c5
%if 0%{?with_py3}
Orion Poplawski c4b6a96
%files -n python%{python3_pkgversion}-%{srcname}
Orion Poplawski c4b6a96
%doc CHANGELOG README.md
Orion Poplawski c4b6a96
%license LICENSE
0954328
%{python3_sitearch}/%{srcname}/
0954328
%{python3_sitearch}/%{srcname}*.egg-info/
0954328
%exclude %{python3_sitearch}/%{srcname}/tests
Jerry James 0e745c5
%endif
Jerry James 0e745c5
Jerry James 0e745c5
%changelog
c3016da
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.2-12
c3016da
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
c3016da
9a9fa43
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.2-11
9a9fa43
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
9a9fa43
3803470
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.2-10
3803470
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
3803470
180d7e7
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.2-9
180d7e7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
180d7e7
Orion Poplawski c4b6a96
* Thu Dec 22 2016 Orion Poplawski <orion@cora.nwra.com> - 1.0.2-8
Orion Poplawski c4b6a96
- Build python3 for EPEL
Orion Poplawski c4b6a96
- Use single build directory
Orion Poplawski c4b6a96
- Run tests as upstream does
Orion Poplawski c4b6a96
8415c6e
* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 1.0.2-7
8415c6e
- Rebuild for Python 3.6
8415c6e
5bdf853
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.2-6
5bdf853
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
5bdf853
d603feb
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.2-5
d603feb
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
d603feb
1d692c3
* Mon Feb  1 2016 Jerry James <loganjerry@gmail.com> - 1.0.2-4
1d692c3
- Comply with latest python packaging guidelines
1d692c3
Orion Poplawski bdb7878
* Tue Nov 10 2015 Orion Poplawski <orion@cora.nwra.com> - 1.0.2-4
Orion Poplawski 92be65c
- Use python2/3_version macros
Orion Poplawski 92be65c
c397de3
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.2-4
c397de3
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
c397de3
ebfe6b4
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.2-3
ebfe6b4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
ebfe6b4
Jerry James 0e745c5
* Mon Dec  1 2014 Jerry James <loganjerry@gmail.com> - 1.0.2-2
Jerry James 0e745c5
- Be more verbose in the file listing
Jerry James 0e745c5
- Run the tests verbosely
Jerry James 0e745c5
Jerry James 0e745c5
* Fri Nov 21 2014 Jerry James <loganjerry@gmail.com> - 1.0.2-1
Jerry James 0e745c5
- Initial RPM