# pyproj 1.9 only works with Proj 4.8. 1.8.9 works with 4.7.
# This module works with Python 3
%if 0%{?fedora} || 0%{?rhel} > 6
%global with_python3 1
%endif
%global svn 20120712svn300
Name: pyproj
Version: 1.9.2
Release: 5.%{svn}%{?dist}
Summary: Cython wrapper to provide python interfaces to Proj
Group: Development/Libraries
License: MIT
URL: http://code.google.com/p/pyproj
#Source0: http://%{name}.googlecode.com/files/%{name}-%{version}.tar.gz
# The source for this package was pulled from upstream's vcs. Use the
# following commands to generate the tarball:
# svn export -r 300 http://pyproj.googlecode.com/svn/trunk/ pyproj-1.9.2
# tar -zcvf pyproj-1.9.2-20120712svn300.tar.gz pyproj-1.9.2
Source0: %{name}-%{version}-%{svn}.tar.gz
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: numpy
BuildRequires: Cython
BuildRequires: proj-devel = 4.8.0
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-numpy
%endif # if with_python3
Requires: proj-nad
# avoid providing the private libs:
%{?filter_setup:
%filter_provides_in %{python_sitearch}.*\.so$
%filter_setup
}
%if 0%{?with_python3}
%{?filter_setup:
%filter_provides_in %{python3_sitearch}.*\.so$
%filter_setup
}
%endif # if with_python3
%description
Cython wrapper to provide python interfaces to Proj
Performs cartographic transformations between geographic (Lat/Lon)
and map projection (x/y) coordinates. Can also transform directly
from one map projection coordinate system to another.
Coordinates can be given as numpy arrays, python arrays, lists or scalars.
Optimized for numpy arrays.
%if 0%{?with_python3}
%package -n python3-%{name}
Summary: Cython wrapper to provide python 3 interfaces to Proj
%description -n python3-%{name}
Cython wrapper to provide python 3 interfaces to Proj
Performs cartographic transformations between geographic (Lat/Lon)
and map projection (x/y) coordinates. Can also transform directly
from one map projection coordinate system to another.
Coordinates can be given as numpy arrays, python arrays, lists or scalars.
Optimized for numpy arrays.
%endif # if with_python3
%prep
%setup -q
# Delete proj sources, Cython generated file and proj data
rm -rf src
rm -f nad2bin.c
rm -f _proj.c
rm -rf lib/%{name}/data
# copy sources to py3dir to not interfere with py2 build
# and if needed modify #! lines of *.py files
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # if with_python3
# Generate Cython C code
cython _proj.pyx
%if 0%{?with_python3}
pushd %{py3dir}
cython -3 _proj.pyx
%endif # if with_python3
%build
export PROJ_DIR="%{_usr}/"
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup-proj.py build
%if 0%{?with_python3}
pushd %{py3dir}
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup-proj.py build
%endif # if with_python3
%install
%{__python} setup-proj.py install --skip-build --root %{buildroot}
# correct wrong write permission for group
chmod 755 %{buildroot}/%{python_sitearch}/%{name}/*.so
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup-proj.py install --skip-build --root %{buildroot}
# correct wrong write permission for group
chmod 755 %{buildroot}/%{python3_sitearch}/%{name}/*.so
%endif # if with_python3
%check
# could be a call to: python test/test.py
# but this seems not a real test script, just a demonstration of
# how to call the library. No expected outputs or other such
# checks are implemented at the moment.
# Therefore no check section has been defined for now.
%files
%doc Changelog docs README
%{python_sitearch}/%{name}
%{python_sitearch}/%{name}-*-py*.egg-info
# note: the provided create_docs.sh script would suggest that
# epydoc is needed to build the docs in subdir docs. However
# the upstream author has already run this tool and has added
# the resulting files to svn, so this is not needed during
# rpm creation after all.
%if 0%{?with_python3}
%files -n python3-%{name}
%doc Changelog docs README
%{python3_sitearch}/%{name}
%{python3_sitearch}/%{name}-*-py*.egg-info
%endif # with_python3
%changelog
* Wed Jul 12 2012 Jos de Kloe <josdekloe@gmail.com> 1.9.2-5.20120712svn300
o- adapted version number format to comply to the Snapshot packages
guidelines, and move to svn revision 300.
* Wed Jun 20 2012 Jos de Kloe <josdekloe@gmail.com> 1.9.2-4.r298
o- Added proj-nad as explicit Requirement since it contains data files needed
to run the module, and bumped the version number to the one mentioned in
the setup-proj.py script
* Fri Jun 15 2012 Jos de Kloe <josdekloe@gmail.com> 1.9.0-3.r298
o- Adapted to build with python3
* Wed May 31 2012 Jos de Kloe <josdekloe@gmail.com> 1.9.0-2.r298
o- Adapted to svn revision r298 which has some modifications
to allow building without using the included proj sources
* Mon Apr 23 2012 Volker Fröhlich <volker27@gmx.at> - 1.9.0-1
o- Initial package for Fedora