Merge pull request #64551 from jonringer/update-pyproj

proj: 5.2.0 -> 6.1.1
This commit is contained in:
Frederik Rietdijk
2019-07-15 21:14:04 +02:00
committed by GitHub
24 changed files with 409 additions and 179 deletions

View File

@@ -1,9 +1,10 @@
{ buildPythonPackage, lib, fetchPypi
, pytest, filelock, mock, pep8
, cython, isPy27
, six, pyshp, shapely, geos, proj, numpy
, six, pyshp, shapely, geos, numpy
, gdal, pillow, matplotlib, pyepsg, pykdtree, scipy, owslib, fiona
, xvfb_run
, proj_5 # see https://github.com/SciTools/cartopy/pull/1252 for status on proj 6 support
}:
buildPythonPackage rec {
@@ -27,17 +28,17 @@ buildPythonPackage rec {
export HOME=$(mktemp -d)
${maybeXvfbRun} pytest --pyargs cartopy \
-m "not network and not natural_earth" \
-k "not test_nightshade_image"
-k "not test_nightshade_image and not background_img"
'';
nativeBuildInputs = [
cython
geos # for geos-config
proj
proj_5
];
buildInputs = [
geos proj
geos proj_5
];
propagatedBuildInputs = [

View File

@@ -1,7 +1,7 @@
{ stdenv, buildPythonPackage, fetchPypi, isPy3k, pythonOlder
, attrs, click, cligj, click-plugins, six, munch, enum34
, pytest, boto3, mock
, gdal
, gdal_2 # can't bump to 3 yet, https://github.com/Toblerity/Fiona/issues/745
}:
buildPythonPackage rec {
@@ -16,11 +16,11 @@ buildPythonPackage rec {
CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isClang "-std=c++11";
nativeBuildInputs = [
gdal # for gdal-config
gdal_2 # for gdal-config
];
buildInputs = [
gdal
gdal_2
];
propagatedBuildInputs = [

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; }))
}