41deeb1
%if 0%{?fedora} || 0%{?rhel} > 6
41deeb1
%global with_python3 1
41deeb1
%endif
41deeb1
41deeb1
Name:           pyproj
bf51713
Version:        1.9.5.1
b6163d9
Release:        5%{?dist}
41deeb1
Summary:        Cython wrapper to provide python interfaces to Proj
41deeb1
41deeb1
Group:          Development/Libraries
41deeb1
License:        MIT
ff7206e
URL:            https://github.com/jswhit/%{name}
ff7206e
Source0:        https://pypi.python.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz
41deeb1
bf51713
# remove the test on the inverse hammer patch, since that depends on a function
bf51713
# in proj.4 that has not yet been released (it was written by the pyproj
bf51713
# author and contributed to the proj.4 project, but is only expected in the
bf51713
# upcoming 4.9.3 release, which is not yet available)
bf51713
# see: https://github.com/jswhit/pyproj/issues/19
bf51713
Patch0: %{name}-%{version}-no_inv_hammer_test.patch
6e2e453
41deeb1
BuildRequires:  python2-devel
41deeb1
BuildRequires:  numpy
41deeb1
BuildRequires:  Cython
ff7206e
BuildRequires:  proj-devel
41deeb1
%if 0%{?with_python3}
41deeb1
BuildRequires:  python3-devel
41deeb1
BuildRequires:  python3-numpy
41deeb1
%endif # if with_python3
bf51713
# needed to remove the hardcoded path '/usr/lib' from the _proj.so file
6e2e453
BuildRequires: chrpath
41deeb1
41deeb1
Requires:  proj-nad
ace7009
Requires:  proj-epsg
41deeb1
bf51713
# these 2 are needed during the tests run in the check section
bf51713
BuildRequires:  proj-nad
bf51713
BuildRequires:  proj-epsg
bf51713
41deeb1
# avoid providing the private libs:
41deeb1
%{?filter_setup:
ff7206e
%filter_provides_in %{python2_sitearch}.*\.so$
41deeb1
%filter_setup
41deeb1
}
41deeb1
41deeb1
%if 0%{?with_python3}
41deeb1
%{?filter_setup:
41deeb1
%filter_provides_in %{python3_sitearch}.*\.so$
41deeb1
%filter_setup
41deeb1
}
41deeb1
%endif # if with_python3
41deeb1
41deeb1
%description
41deeb1
Cython wrapper to provide python interfaces to Proj
41deeb1
41deeb1
Performs cartographic transformations between geographic (Lat/Lon)
41deeb1
and map projection (x/y) coordinates. Can also transform directly
41deeb1
from one map projection coordinate system to another.
41deeb1
Coordinates can be given as numpy arrays, python arrays, lists or scalars.
41deeb1
Optimized for numpy arrays.
41deeb1
41deeb1
%if 0%{?with_python3}
41deeb1
%package -n python3-%{name}
41deeb1
Summary:        Cython wrapper to provide python 3 interfaces to Proj
41deeb1
41deeb1
%description -n python3-%{name}
41deeb1
Cython wrapper to provide python 3 interfaces to Proj
41deeb1
41deeb1
Performs cartographic transformations between geographic (Lat/Lon)
41deeb1
and map projection (x/y) coordinates. Can also transform directly
41deeb1
from one map projection coordinate system to another.
41deeb1
Coordinates can be given as numpy arrays, python arrays, lists or scalars.
41deeb1
Optimized for numpy arrays.
41deeb1
41deeb1
%endif # if with_python3
41deeb1
41deeb1
%prep
41deeb1
%setup -q
6e2e453
%patch0 -p0 -b .orig
41deeb1
41deeb1
# Delete proj sources, Cython generated file and proj data
41deeb1
rm -rf src
41deeb1
rm -f nad2bin.c
41deeb1
rm -f _proj.c
41deeb1
rm -rf lib/%{name}/data
41deeb1
41deeb1
# copy sources to py3dir to not interfere with py2 build
41deeb1
# and if needed modify #! lines of *.py files
41deeb1
%if 0%{?with_python3}
41deeb1
rm -rf %{py3dir}
41deeb1
cp -a . %{py3dir}
41deeb1
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
41deeb1
%endif # if with_python3
41deeb1
41deeb1
# Generate Cython C code
41deeb1
cython _proj.pyx
41deeb1
41deeb1
%if 0%{?with_python3}
41deeb1
pushd %{py3dir}
41deeb1
cython -3 _proj.pyx
ff7206e
popd
41deeb1
%endif # if with_python3
41deeb1
41deeb1
%build
41deeb1
export PROJ_DIR="%{_usr}/"
bf51713
CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build
41deeb1
41deeb1
%if 0%{?with_python3}
41deeb1
pushd %{py3dir}
bf51713
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
ff7206e
popd
41deeb1
%endif # if with_python3
41deeb1
41deeb1
%install
bf51713
export PROJ_DIR="%{_usr}/"
bf51713
%{__python2} setup.py install --skip-build --root %{buildroot}
41deeb1
41deeb1
# correct wrong write permission for group
ff7206e
chmod 755  %{buildroot}/%{python2_sitearch}/%{name}/*.so
41deeb1
6e2e453
# remove the rpath setting from _proj.so
6e2e453
chrpath -d %{buildroot}/%{python2_sitearch}/%{name}/*.so
6e2e453
41deeb1
%if 0%{?with_python3}
41deeb1
pushd %{py3dir}
bf51713
%{__python3} setup.py install --skip-build --root %{buildroot}
41deeb1
41deeb1
# correct wrong write permission for group
41deeb1
chmod 755  %{buildroot}/%{python3_sitearch}/%{name}/*.so
41deeb1
6e2e453
# remove the rpath setting from _proj.so
6e2e453
chrpath -d %{buildroot}/%{python3_sitearch}/%{name}/*.so
6e2e453
ff7206e
popd
41deeb1
%endif # if with_python3
41deeb1
ff7206e
%check
ff7206e
ff7206e
# note1: the test() function is automatically called if the
bf51713
# __init__.py file is run as main script, but I could not yet figure out
ff7206e
# how to do this in this spec file, so just manually call the test() function.
ff7206e
bf51713
# run old tests
ff7206e
PYTHONPATH="%{buildroot}%{python2_sitearch}" %{__python2} -c 'import pyproj;pyproj.test()'
bf51713
#run new tests (see README.md)
bf51713
PYTHONPATH="%{buildroot}%{python2_sitearch}" %{__python2} unittest/test.py
ff7206e
%if 0%{?with_python3}
ff7206e
pushd %{py3dir}
bf51713
# run old tests
ff7206e
PYTHONPATH="%{buildroot}%{python3_sitearch}" %{__python3} -c 'import pyproj;pyproj.test()'
bf51713
# run new tests (see README.md)
bf51713
PYTHONPATH="%{buildroot}%{python3_sitearch}" %{__python3} unittest/test.py
ff7206e
popd
ff7206e
%endif # if with_python3
41deeb1
41deeb1
%files
ff7206e
%doc Changelog docs README.md
ff7206e
%{python2_sitearch}/%{name}
ff7206e
%{python2_sitearch}/%{name}-*-py*.egg-info
41deeb1
41deeb1
# note: the provided create_docs.sh script would suggest that
41deeb1
# epydoc is needed to build the docs in subdir docs. However
41deeb1
# the upstream author has already run this tool and has added
ff7206e
# the resulting files to svn, so this is not needed during
ff7206e
# rpm creation after all.
41deeb1
41deeb1
%if 0%{?with_python3}
41deeb1
%files -n python3-%{name}
ff7206e
%doc Changelog docs README.md
41deeb1
%{python3_sitearch}/%{name}
41deeb1
%{python3_sitearch}/%{name}-*-py*.egg-info
41deeb1
%endif # with_python3
41deeb1
41deeb1
%changelog
b6163d9
b6163d9
* Wed Feb 01 2017 Jos de Kloe <josdekloe@gmail.com> 1.9.5.1-5
b6163d9
- force rebuild after libproj soname jump
b6163d9
3053776
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 1.9.5.1-4
3053776
- Rebuild for Python 3.6
3053776
ca3244a
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.5.1-3
ca3244a
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
ca3244a
402cbd7
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.5.1-2
402cbd7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
402cbd7
bf51713
* Thu Jan 14 2016 Jos de Kloe <josdekloe@gmail.com> 1.9.5.1-1
bf51713
- update to new upstream version
bf51713
- remove the inverse hammer test
bf51713
498e00c
* Thu Nov 12 2015 Jos de Kloe <josdekloe@gmail.com> 1.9.4-4
6e2e453
- apply patch to fix a bug in _proj.pyx that surfaced in cython 0.23
6e2e453
- apply chrpath to fix binary-or-shlib-defines-rpath error reported by rpmlint
6e2e453
2db8799
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.4-3
2db8799
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
2db8799
ef7eafa
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.4-2
ef7eafa
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
ef7eafa
ff7206e
* Thu Mar 12 2015 Jos de Kloe <josdekloe@gmail.com> 1.9.4-1
ff7206e
- update to version 1.9.4
ff7206e
- replace python_sitearch macro with python2_sitearch
ff7206e
- replace the deprecated macro __python by __python3
ff7206e
- activate the check section
4544c32
ace7009
* Sat Jan 11 2014 Jos de Kloe <josdekloe@gmail.com> 1.9.2-8.20120712svn300
ace7009
- replace the deprecated macro __python by __python2
ace7009
- require proj-epsg to solve bug #1022238
ace7009
bd4353c
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.2-7.20120712svn300
bd4353c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
bd4353c
74369d0
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.2-6.20120712svn300
74369d0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
74369d0
ace7009
* Thu Jul 12 2012 Jos de Kloe <josdekloe@gmail.com> 1.9.2-5.20120712svn300
ace7009
- adapted version number format to comply to the Snapshot packages 
ace7009
  guidelines, and move to svn revision 300.
ace7009
41deeb1
* Wed Jun 20 2012 Jos de Kloe <josdekloe@gmail.com> 1.9.2-4.r298
ace7009
- Added proj-nad as explicit Requirement since it contains data files needed
ace7009
  to run the module, and bumped the version number to the one mentioned in 
ace7009
  the setup-proj.py script
ace7009
41deeb1
* Fri Jun 15 2012 Jos de Kloe <josdekloe@gmail.com> 1.9.0-3.r298
ace7009
- Adapted to build with python3
ace7009
ace7009
* Thu May 31 2012 Jos de Kloe <josdekloe@gmail.com> 1.9.0-2.r298
ace7009
- Adapted to svn revision r298 which has some modifications
ace7009
  to allow building without using the included proj sources
ace7009
41deeb1
* Mon Apr 23 2012 Volker Fröhlich <volker27@gmx.at> - 1.9.0-1
ace7009
- Initial package for Fedora