%global srcname apipkg
%if 0%{?fedora}
%global with_python3 1
%endif
Name: python-%{srcname}
Version: 1.4
Release: 1%{?dist}
Summary: A Python namespace control and lazy-import mechanism
License: MIT
URL: http://pypi.python.org/pypi/apipkg
Source0: http://pypi.python.org/packages/source/a/%{srcname}/%{srcname}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-setuptools
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%endif
%description
With apipkg you can control the exported namespace of a python package and
greatly reduce the number of imports for your users. It is a small python
module that works on virtually all Python versions, including CPython2.3 to
Python3.1, Jython and PyPy. It co-operates well with Python's help() system,
custom importers (PEP302) and common command line completion tools.
%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary: A Python namespace control and lazy-import mechanism
%description -n python3-%{srcname}
With apipkg you can control the exported namespace of a python package and
greatly reduce the number of imports for your users. It is a small python
module that works on virtually all Python versions, including CPython2.3 to
Python3.1, Jython and PyPy. It co-operates well with Python's help() system,
custom importers (PEP302) and common command line completion tools.
%endif
%prep
%setup -q -n %{srcname}-%{version}
rm -rf %{srcname}.egg-info
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif
%build
%{__python2} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif
%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif
%{__python2} setup.py install --skip-build --root %{buildroot}
%files
%doc CHANGELOG README.txt
%{python2_sitelib}/*
%if 0%{?with_python3}
%files -n python3-%{srcname}
%doc CHANGELOG README.txt
%{python3_sitelib}/*
%endif
%changelog
* Sat Oct 17 2015 Fabian Affolter <mail@fabian-affolter.ch> - 1.4-1
- Update to new upstream version 1.4 (rhbz#1239818)
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Tue Mar 10 2015 Fabian Affolter <mail@fabian-affolter.ch> - 1.3-1
- Update to new upstream version 1.3 (rhbz#1199807)
* Wed Feb 18 2015 Fabian Affolter <mail@fabian-affolter.ch> - 1.2-7
- Enable py3 package
* Fri Oct 03 2014 Fabian Affolter <mail@fabian-affolter.ch> - 1.2-6
- Update to match guidelines
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Tue May 27 2014 Kalev Lember <kalevlember@gmail.com> - 1.2-4
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Sat Nov 10 2012 Fabian Affolter <mail@fabian-affolter.ch> - 1.2-1
- Update to match new guidelines
- Python3
- Update to new upstream version 1.2
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Mon Nov 08 2010 Fabian Affolter <mail@fabian-affolter.ch> - 1.0-1
- Initial package