# note: PROJ_MIN_VERSION is defined in the setup.py file of pyproj # a compatibility matrix is also provided in docs/installation.rst %global minimal_needed_proj_version 8.2.0 Name: pyproj Version: 3.4.1 Release: 2%{?dist} Summary: Cython wrapper to provide python interfaces to Proj # this software uses the "MIT:Modern Style with sublicense" license License: MIT URL: https://github.com/jswhit/%{name} Source0: https://files.pythonhosted.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz # Change the pygments style to default, since the material style is not # available in EPEL9 Patch1: pyproj-sphynx-pygments.patch BuildRequires: make BuildRequires: gcc BuildRequires: proj-devel >= %{minimal_needed_proj_version} BuildRequires: proj >= %{minimal_needed_proj_version} BuildRequires: python3-setuptools BuildRequires: python3-devel BuildRequires: python3-numpy BuildRequires: python3-Cython BuildRequires: python3-certifi # needed to run the tests BuildRequires: python3-pytest # not yet available for EPEL9: # BuildRequires: python3-pandas BuildRequires: python3-shapely # not yet available for EPEL9: # BuildRequires: python3-xarray # needed to remove the hardcoded rpath '/usr/lib' from the _proj.so file BuildRequires: chrpath # needed to build the documentation BuildRequires: python3-sphinx BuildRequires: python3-sphinx-argparse BuildRequires: python3-sphinx_rtd_theme %global _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. %description %_description %package -n python3-%{name} Summary: %summary Requires: proj >= %{minimal_needed_proj_version} # ensure python provides are provided when python3 becomes the default runtime %{?python_provide:%python_provide python3-%{name}} %description -n python3-%{name} %_description %package -n python3-%{name}-doc Summary: Documentation and example code BuildArch: noarch %description -n python3-%{name}-doc This package contains the html documentation for the pyproj module. %prep %autosetup -p1 # remove use of /usr/bin/env in docs/conf.py sed -i -e 's/^#!\/usr\/bin\/env python3/#!\/usr\/bin\/python3/g' docs/conf.py %build export PROJ_DIR="%{_usr}/" %py3_build # generate documentation cd docs # Need to point to the build dir so sphinx can import the module # before it is installed. # Note that the new Python macros have %%{pyproject_build_lib} for this, # but this package uses the old macros, so we need to replicate the behavior manually. # The path has changed in setuptools 62.4.0, see https://bugzilla.redhat.com/2097115 %global py_build_libdir_old %{_builddir}/%{buildsubdir}/build/lib.%{python3_platform}-%{python3_version} %global py_build_libdir_new %{_builddir}/%{buildsubdir}/build/lib.%{python3_platform}-cpython-%{python3_version_nodots} # NOTE: need to add %%{_builddir}/%%{buildsubdir} as well to the path # since sphinx needs to be able to find the PKG-INFO file # before it will generate the documentation, # and this is the only place where it is available before installation. # (see: https://github.com/python/importlib_metadata/issues/364) export PYTHONPATH=%{py_build_libdir_old}:%{py_build_libdir_new}:%{_builddir}/%{buildsubdir} # default theme is now "furo" which is not available in fedora # (see BZ #1910798 and https://github.com/pyproj4/pyproj/discussions/1134) # so fall back to the previous theme: export PYPROJ_HTML_THEME=sphinx_rtd_theme make html make man # rpmlint complains many times with the rather cryptic warning: # "a special character is not allowed in a name" # Actually for this man page this indicates a syntax error, since # it does not have a space after ".B" in many places. # (it is not clear to me where this originates, from the sphinx tool # or the input sources.) # This sed command corrects for this problem. sed -i -e 's/^\.B\\-/\.B \\-/g' %{_builddir}/%{name}-%{version}/docs/_build/man/pyproj.1 %install export PROJ_DIR="%{_usr}/" %py3_install # ensure the autogenerated hidden .buildinfo file is not included # since rpmlint does not like hidden files in the documentation %{__rm} %{_builddir}/%{name}-%{version}/docs/_build/html/.buildinfo # move html documentation to datadir/doc mkdir -p %{buildroot}%{_datadir}/doc/%{name} mv %{_builddir}/%{name}-%{version}/docs/_build/html \ %{buildroot}%{_datadir}/doc/%{name}/html # copy pyproj man page mkdir -p %{buildroot}/%{_mandir}/man1 cp %{_builddir}/%{name}-%{version}/docs/_build/man/pyproj.1 \ %{buildroot}/%{_mandir}/man1/ # remove the documentation sources and generated doctrees # since they dont belong in the main package %{__rm} -rf %{_builddir}/%{name}-%{version}/docs # correct wrong write permission for group %{__chmod} 755 %{buildroot}/%{python3_sitearch}/%{name}/*.so # remove the rpath setting from _proj.so chrpath -d %{buildroot}/%{python3_sitearch}/%{name}/*.so %check # follow the hint given in pyproj github issue # https://github.com/pyproj4/pyproj/issues/647 # i.e. take the test folder outside the build folder # to prevent the # cannot import name '_datadir' from partially initialized module # 'pyproj' (most likely due to a circular import) # error. # (probably this is not needed anymore but it doesn't hurt to leave this in) cd .. mkdir pyproj-test-folder cd pyproj-test-folder cp -r ../pyproj-%{version}/test . cp -r ../pyproj-%{version}/pytest.ini . # disable test_utils.py for now, since that is the only test module # that requires pandas and xarray PATH="%{buildroot}%{_bindir}:$PATH" \ PYTHONPATH="%{buildroot}%{python3_sitearch}" \ py.test-3 -m "not network and not grid" --ignore=test/test_utils.py # some notes on the test suite: # total number of testcases for version 3.4.1 is 841. # -m "not network" ==> deselects 24 tests # -m "not grid" ==> deselects 11 tests # --ignore=test/test_utils.py ==> deselects 14 tests # # network: these tests depend on downloading data from the network # which is not possible during the build process. # # grid: 1 failure for epel9 (test/test_transformer.py) # note on failing grid test: # this seems caused by an intentional change of behavior of the proj library. # between proj v9.0.1 and proj v9.1.0 # The test suite of pyproj has adapted to the new behaviour but # it was forgotten to add compatibility code to allow use of the # older proj versions as well. # Therefore it seems safe to just skip this test for now. # See: https://github.com/pyproj4/pyproj/issues/1141 # # test/test_utils.py # this module imports pandas and xarray and cannot be used # as long as those python modules are not packages for epel9 %files -n python3-%{name} %doc README.md %{_bindir}/%{name} %{python3_sitearch}/%{name}/ %{python3_sitearch}/%{name}-*-py*.egg-info/ %{_mandir}/man1/pyproj* %files -n python3-%{name}-doc %doc %{_datadir}/doc/%{name}/ %changelog * Tue Jun 24 2025 Orion Poplawski - 3.4.1-2 - Rebuild for proj 9 * Sun Jan 08 2023 Jos de Kloe 3.4.1-1 - First EPEL9 version