Blob Blame History Raw
%if 0%{?fedora}
%global with_python3 1
%endif

# Define modern python2 macros for el6.
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2:        %global __python2 /usr/bin/python2}
%{!?python2_sitelib:  %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif

%global modname geojson

Name:               python-geojson
Version:            1.0.9
Release:            2%{?dist}
Summary:            Encoder/decoder for simple GIS features

Group:              Development/Libraries
License:            BSD
URL:                http://pypi.python.org/pypi/geojson
Source0:            http://pypi.python.org/packages/source/g/%{modname}/%{modname}-%{version}.tar.gz

BuildArch:          noarch

BuildRequires:      python2-devel
BuildRequires:      python-setuptools
BuildRequires:      python-simplejson

Requires:           python-setuptools
Requires:           python-simplejson

%description
Geojson provides geometry, feature, and collection classes, and supports
pickle-style dump and load of objects that provide the lab's Python geo
interface.

%if 0%{?with_python3}
%package -n python3-geojson
Summary:            Encoder/decoder for simple GIS features
Group:              Development/Libraries

BuildRequires:      python3-devel
BuildRequires:      python3-setuptools
BuildRequires:      python3-simplejson

Requires:           python3-setuptools
Requires:           python3-simplejson

%description -n python3-geojson
Geojson provides geometry, feature, and collection classes, and supports
pickle-style dump and load of objects that provide the lab's Python geo
interface.
%endif

%prep
%setup -q -n %{modname}-%{version}

# Remove bundled egg-info in case it exists
rm -rf %{modname}.egg-info

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

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

%{__python2} setup.py build

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

%{__python2} setup.py install -O1 --skip-build --root=%{buildroot}

## The tests need a data file that isn't in the tarball.
#%%check
#%%{__python} setup.py test

%files
%doc README.rst LICENSE.rst CHANGELOG.rst
%{python2_sitelib}/%{modname}/
%{python2_sitelib}/%{modname}-%{version}*

%if 0%{?with_python3}
%files -n python3-geojson
%doc README.rst LICENSE.rst CHANGELOG.rst
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/%{modname}-%{version}*
%endif

%changelog
* Wed May 06 2015 Ralph Bean <rbean@redhat.com> - 1.0.9-2
- Python3 subpackage!

* Wed May 06 2015 Ralph Bean <rbean@redhat.com> - 1.0.9-1
- Latest upstream.
- Changed %%doc files, which changed upstream.
- Removed patch and just made setuptools a runtime dep.

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

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

* Mon Mar 04 2013 Ralph Bean <rbean@redhat.com> - 1.0.1-2
- Remove setuptools runtime requirement.
- Remove example from description.

* Wed Feb 27 2013 Ralph Bean <rbean@redhat.com> - 1.0.1-1
- Initial package for Fedora