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

Name:           pyshp
Version:        1.2.1
Release:        1%{?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

# Change line endings, otherwise doctest fails
# Remaining tests should only fail due to missing test data
sed -i 's/.$//' README.txt changelog.txt

# 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}
pushd %{py3dir}
%{__python3} shapefile.py
%endif # if with_python3


%files
# Oct 2013: Mailed the author about including a license file
# http://code.google.com/p/pyshp/source/detail?r=92
# Same information as in PKG-INFO
%doc changelog.txt 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
* Mon May 12 2014 Volker Fröhlich <volker27@gmx.at> - 1.2.1-1
- New upstream release
- Properly check on Python 3 builds

* Thu Jan 23 2014 Volker Fröhlich <volker27@gmx.at> - 1.2.0-2
- Disable Python 3 builds for EPEL7 until Python 3 is available there

* Sun Oct 06 2013 Volker Fröhlich <volker27@gmx.at> - 1.2.0-1
- New upstream release

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.4-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.4-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* 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