aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/development/python-modules/pyproj
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2019-10-05 12:43:18 +0000
committerKatharina Fey <kookie@spacekookie.de>2019-10-05 12:44:52 +0000
commitcf85056ba64caf3267d43255ef4a1243e9c8ee3b (patch)
tree3051519e9c8275b870aac43f80af875715c9d124 /nixpkgs/pkgs/development/python-modules/pyproj
parent1148b1d122bc03e9a3665856c9b7bb96bd4e3994 (diff)
parent2436c27541b2f52deea3a4c1691216a02152e729 (diff)
Add 'nixpkgs/' from commit '2436c27541b2f52deea3a4c1691216a02152e729'
git-subtree-dir: nixpkgs git-subtree-mainline: 1148b1d122bc03e9a3665856c9b7bb96bd4e3994 git-subtree-split: 2436c27541b2f52deea3a4c1691216a02152e729
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/pyproj')
-rw-r--r--nixpkgs/pkgs/development/python-modules/pyproj/001.proj.patch47
-rw-r--r--nixpkgs/pkgs/development/python-modules/pyproj/default.nix51
2 files changed, 98 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/pyproj/001.proj.patch b/nixpkgs/pkgs/development/python-modules/pyproj/001.proj.patch
new file mode 100644
index 00000000000..b024c28156c
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pyproj/001.proj.patch
@@ -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:
diff --git a/nixpkgs/pkgs/development/python-modules/pyproj/default.nix b/nixpkgs/pkgs/development/python-modules/pyproj/default.nix
new file mode 100644
index 00000000000..0f2763faf60
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pyproj/default.nix
@@ -0,0 +1,51 @@
+{ lib, buildPythonPackage, fetchFromGitHub, python, pkgs, pythonOlder, substituteAll
+, aenum
+, cython
+, pytest
+, mock
+, numpy
+}:
+
+buildPythonPackage rec {
+ pname = "pyproj";
+ version = "2.2.2";
+
+ src = fetchFromGitHub {
+ owner = "pyproj4";
+ repo = "pyproj";
+ rev = "v${version}rel";
+ sha256 = "0mb0jczgqh3sma69k7237i38h09gxgmvmddls9hpw4f3131f5ax7";
+ };
+
+ # force pyproj to use ${pkgs.proj}
+ patches = [
+ (substituteAll {
+ src = ./001.proj.patch;
+ proj = pkgs.proj;
+ })
+ ];
+
+ 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 = ''
+ 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";
+ license = with lib.licenses; [ isc ];
+ };
+}