Blob Blame History Raw
# This module works with Python 3
%if 0%{?fedora} || 0%{?rhel} > 6
%global with_python3 1
%endif

Name:           pyshp
Version:        1.1.4
Release:        5%{?dist}
Summary:        Pure Python read/write support for ESRI Shapefile format
Group:          Development/Libraries
License:        MIT
URL:            http://code.google.com/p/pyshp
Source0:        http://pypi.python.org/packages/source/p/%{name}/%{name}-%{version}.zip

BuildRequires:  python2-devel
BuildRequires:  python-setuptools
%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
%endif # if with_python3

BuildArch:      noarch


%description
Pure Python read/write support for ESRI Shapefile format

%if 0%{?with_python3}
%package -n python3-%{name}
Summary:        Pure Python 3 read/write support for ESRI Shapefile format
Group:          Development/Libraries

%description -n python3-%{name}
Pure Python read/write support for ESRI Shapefile format

%endif # if with_python3


%prep
%setup -q

# Delete the egg info to certainly ship the generated
rm -rf pyshp.egg-info

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


%build
%{__python} setup.py build

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


%install
%{__python} setup.py install --skip-build --root %{buildroot}

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


%check
%{__python} shapefile.py

%if 0%{?with_python3}
%{__python3} shapefile.py
%endif # if with_python3


%files
# The author will ship a license file from releases after 1.1.4 on.

# Same information as in PKG-INFO
#%%doc README.txt
%{python_sitelib}/shapefile.py*
%{python_sitelib}/%{name}-%{version}-py*.egg-info

%if 0%{?with_python3}
%files -n python3-%{name}
%{python3_sitelib}/shapefile.py*
%{python3_sitelib}/%{name}-%{version}-py*.egg-info
%{python3_sitelib}/__pycache__/shapefile*
%endif # with_python3


%changelog
* Sat Aug 04 2012 David Malcolm <dmalcolm@redhat.com> - 1.1.4-5
- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Sat May 19 2012 Volker Fröhlich <volker27@gmx.at> - 1.1.4-3
- Move BR python3-devel in conditional block

* Fri May 18 2012 Volker Fröhlich <volker27@gmx.at> - 1.1.4-2
- Run doctests
- Delete the original egg-info

* Sun Apr 22 2012 Volker Fröhlich <volker27@gmx.at> - 1.1.4-1
- Initial package for Fedora