pythonPackages.pyproj: unstable-2018-11-13 -> 2.2.1

This commit is contained in:
Jonathan Ringer 2019-07-09 17:42:01 -07:00
parent d55cba68ff
commit 06960ac6a7
3 changed files with 81 additions and 27 deletions

View file

@ -0,0 +1,47 @@
diff a/pyproj/datadir.py b/pyproj/datadir.py
--- a/pyproj/datadir.py
+++ b/pyproj/datadir.py
@@ -52,6 +52,7 @@ def get_data_dir():
str: The valid data directory.
"""
+ return "@proj@/share/proj"
# to avoid re-validating
global _VALIDATED_PROJ_DATA
if _VALIDATED_PROJ_DATA is not None:
diff a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@ INTERNAL_PROJ_DIR = os.path.join(CURRENT_FILE_PATH, "pyproj", BASE_INTERNAL_PROJ
def check_proj_version(proj_dir):
"""checks that the PROJ library meets the minimum version"""
- proj = os.path.join(proj_dir, "bin", "proj")
+ proj = "@proj@/bin/proj"
proj_ver_bytes = subprocess.check_output(proj, stderr=subprocess.STDOUT)
proj_ver_bytes = (proj_ver_bytes.decode("ascii").split()[1]).strip(",")
proj_version = parse_version(proj_ver_bytes)
@@ -33,6 +33,7 @@ def get_proj_dir():
"""
This function finds the base PROJ directory.
"""
+ return "@proj@"
proj_dir = os.environ.get("PROJ_DIR")
if proj_dir is None and os.path.exists(INTERNAL_PROJ_DIR):
proj_dir = INTERNAL_PROJ_DIR
@@ -56,6 +57,7 @@ def get_proj_libdirs(proj_dir):
"""
This function finds the library directories
"""
+ return ["@proj@/lib"]
proj_libdir = os.environ.get("PROJ_LIBDIR")
libdirs = []
if proj_libdir is None:
@@ -77,6 +79,7 @@ def get_proj_incdirs(proj_dir):
"""
This function finds the include directories
"""
+ return ["@proj@/include"]
proj_incdir = os.environ.get("PROJ_INCDIR")
incdirs = []
if proj_incdir is None:

View file

@ -1,38 +1,49 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, python
, nose2
{ lib, buildPythonPackage, fetchPypi, python, pkgs, pythonOlder, substituteAll
, aenum
, cython
, proj ? null
, pytest
, mock
, numpy
}:
buildPythonPackage (rec {
buildPythonPackage rec {
pname = "pyproj";
version = "unstable-2018-11-13";
version = "2.2.1";
src = fetchFromGitHub {
owner = "jswhit";
repo = pname;
rev = "78540f5ff40da92160f80860416c91ee74b7643c";
sha256 = "1vq5smxmpdjxialxxglsfh48wx8kaq9sc5mqqxn4fgv1r5n1m3n9";
src = fetchPypi {
inherit pname version;
sha256 = "0yigcxwmx5cczipf2mpmy2gq1dnl0635yjvjq86ay47j1j5fd2gc";
};
buildInputs = [ cython ];
# force pyproj to use ${pkgs.proj}
patches = [
(substituteAll {
src = ./001.proj.patch;
proj = pkgs.proj;
})
];
checkInputs = [ nose2 ];
buildInputs = [ cython pkgs.proj ];
propagatedBuildInputs = [
numpy
] ++ lib.optional (pythonOlder "3.6") aenum;
checkInputs = [ pytest mock ];
# ignore rounding errors, and impure docgen
# datadir is ignored because it does the proj look up logic, which isn't relevant
checkPhase = ''
runHook preCheck
pushd unittest # changing directory should ensure we're importing the global pyproj
${python.interpreter} test.py && ${python.interpreter} -c "import doctest, pyproj, sys; sys.exit(doctest.testmod(pyproj)[0])"
popd
runHook postCheck
pytest . -k 'not alternative_grid_name \
and not transform_wgs84_to_alaska \
and not repr' \
--ignore=test/test_doctest_wrapper.py \
--ignore=test/test_datadir.py
'';
meta = {
description = "Python interface to PROJ.4 library";
homepage = https://github.com/jswhit/pyproj;
homepage = "https://github.com/jswhit/pyproj";
license = with lib.licenses; [ isc ];
};
} // (if proj == null then {} else { PROJ_DIR = proj; }))
}

View file

@ -4032,11 +4032,7 @@ in {
pyotp = callPackage ../development/python-modules/pyotp { };
pyproj = callPackage ../development/python-modules/pyproj {
# pyproj does *work* if you want to use a system supplied proj, but with the current version(s) the tests fail by
# a few decimal places, so caveat emptor.
proj = null;
};
pyproj = callPackage ../development/python-modules/pyproj { };
pyqrcode = callPackage ../development/python-modules/pyqrcode { };