Blob Blame History Raw
%if 0%{?fedora} > 12
%global with_python3 1
%else
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif

%global srcname apipkg

Name:           python-%{srcname}
Version:        1.2
Release:        1%{?dist}
Summary:        Python namespace control and lazy-import mechanism

Group:          Development/Languages
License:        MIT
URL:            http://pypi.python.org/pypi/apipkg
Source0:        http://pypi.python.org/packages/source/a/%{srcname}/%{srcname}-%{version}.zip
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:        Python namespace control and lazy-import mechanism
Group:          Development/Languages

%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
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif

%build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif
%{__python} setup.py build

%install
%{__python} setup.py install --skip-build --root %{buildroot}
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif

%files
%doc CHANGELOG README.txt
%{python_sitelib}/*

%if 0%{?with_python3}
%files -n python3-%{srcname}
%doc CHANGELOG README.txt
%{python3_sitelib}/*
%endif

%changelog
* Sat Nov 10 2012 Fabian Affolter <mail@fabian-affolter.ch> - 1.2-1
- Updated to match new guidlines
- Python3
- Updated 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

* Wed Nov 08 2010 Fabian Affolter <mail@fabian-affolter.ch> - 1.0-1
- Initial package