Merge pull request #119168 from lsix/proj_updates

This commit is contained in:
Sandro 2021-04-13 01:01:20 +02:00 committed by GitHub
commit b4a849d23f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 132 additions and 120 deletions

View File

@ -1,20 +0,0 @@
{ lib, stdenv, fetchurl }:
stdenv.mkDerivation {
name = "proj-5.2.0";
src = fetchurl {
url = "https://download.osgeo.org/proj/proj-5.2.0.tar.gz";
sha256 = "0q3ydh2j8qhwlxmnac72pg69rw2znbi5b6k5wama8qmwzycr94gg";
};
doCheck = stdenv.is64bit;
meta = with lib; {
description = "Cartographic Projections Library";
homepage = "https://proj4.org";
license = licenses.mit;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ vbgl ];
};
}

View File

@ -1,21 +1,21 @@
{ lib, stdenv, fetchFromGitHub, pkg-config, sqlite, autoreconfHook }: { lib, stdenv, fetchFromGitHub, pkg-config, sqlite, autoreconfHook, libtiff, curl }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "proj"; pname = "proj";
version = "6.3.1"; version = "7.2.1";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "OSGeo"; owner = "OSGeo";
repo = "PROJ"; repo = "PROJ";
rev = version; rev = version;
sha256 = "1ildcp57qsa01kvv2qxd05nqw5mg0wfkksiv9l138dbhp0s7rkxp"; sha256 = "0mymvfvs8xggl4axvlj7kc1ksd9g94kaz6w1vdv0x2y5mqk93gx9";
}; };
outputs = [ "out" "dev"]; outputs = [ "out" "dev"];
nativeBuildInputs = [ pkg-config autoreconfHook ]; nativeBuildInputs = [ pkg-config autoreconfHook ];
buildInputs = [ sqlite ]; buildInputs = [ sqlite libtiff curl ];
doCheck = stdenv.is64bit; doCheck = stdenv.is64bit;

View File

@ -1,6 +1,7 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchFromGitHub , fetchFromGitHub
, pythonAtLeast
, numpy , numpy
, matplotlib , matplotlib
, pillow , pillow
@ -43,6 +44,7 @@ buildPythonPackage rec {
http://matplotlib.github.com/basemap/users/examples.html for examples of what it can do. http://matplotlib.github.com/basemap/users/examples.html for examples of what it can do.
''; '';
license = with licenses; [ mit gpl2 ]; license = with licenses; [ mit gpl2 ];
broken = pythonAtLeast "3.9";
}; };
} }

View File

@ -1,10 +1,9 @@
{ buildPythonPackage, lib, fetchPypi { buildPythonPackage, lib, fetchPypi, fetchpatch
, pytest_4, filelock, mock, pep8 , pytestCheckHook, filelock, mock, pep8
, cython, isPy27 , cython
, six, pyshp, shapely, geos, numpy , six, pyshp, shapely, geos, numpy
, gdal, pillow, matplotlib, pyepsg, pykdtree, scipy, owslib, fiona , gdal, pillow, matplotlib, pyepsg, pykdtree, scipy, owslib, fiona
, xvfb_run , proj
, proj_5 # see https://github.com/SciTools/cartopy/pull/1252 for status on proj 6 support
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -17,28 +16,16 @@ buildPythonPackage rec {
sha256 = "0d24fk0cbp29gmkysrwq05vry13swmwi3vx3cpcy04c0ixz33ykz"; sha256 = "0d24fk0cbp29gmkysrwq05vry13swmwi3vx3cpcy04c0ixz33ykz";
}; };
checkInputs = [ filelock mock pytest_4 pep8 ]; patches = [
# Fix numpy-1.20 compatibility. Will be part of 0.19.
# several tests require network connectivity: we disable them. (fetchpatch {
# also py2.7's tk is over-eager in trying to open an x display, url = "https://github.com/SciTools/cartopy/commit/e663bbbef07989a5f8484a8f36ea9c07e61d14ce.patch";
# so give it xvfb sha256 = "061kbjgzkc3apaz6sxy00pkgy3n9dxcgps5wzj4rglb5iy86n2kq";
checkPhase = let })
maybeXvfbRun = lib.optionalString isPy27 "${xvfb_run}/bin/xvfb-run";
in ''
export HOME=$(mktemp -d)
${maybeXvfbRun} pytest --pyargs cartopy \
-m "not network and not natural_earth" \
-k "not test_nightshade_image and not background_img"
'';
nativeBuildInputs = [
cython
geos # for geos-config
proj_5
]; ];
buildInputs = [ buildInputs = [
geos proj_5 geos proj
]; ];
propagatedBuildInputs = [ propagatedBuildInputs = [
@ -49,12 +36,28 @@ buildPythonPackage rec {
gdal pillow matplotlib pyepsg pykdtree scipy fiona owslib gdal pillow matplotlib pyepsg pykdtree scipy fiona owslib
]; ];
checkInputs = [ pytestCheckHook filelock mock pep8 ];
pytestFlagsArray = [
"--pyargs" "cartopy"
"-m" "'not network and not natural_earth'"
];
disabledTests = [
"test_nightshade_image"
"background_img"
];
nativeBuildInputs = [
cython
geos # for geos-config
proj
];
meta = with lib; { meta = with lib; {
description = "Process geospatial data to create maps and perform analyses"; description = "Process geospatial data to create maps and perform analyses";
license = licenses.lgpl3; license = licenses.lgpl3;
homepage = "https://scitools.org.uk/cartopy/docs/latest/"; homepage = "https://scitools.org.uk/cartopy/docs/latest/";
maintainers = with maintainers; [ mredaelli ]; maintainers = with maintainers; [ mredaelli ];
# following tests fail: test_eccentric_globe and test_ellipse_globe
broken = true;
}; };
} }

View File

@ -1,62 +1,56 @@
diff -Nur a/pyproj/datadir.py b/pyproj/datadir.py diff -Nur a/pyproj/datadir.py b/pyproj/datadir.py
--- a/pyproj/datadir.py 2020-03-24 12:53:39.417440608 +0100 --- a/pyproj/datadir.py 2021-04-10 18:26:52.829018483 +0100
+++ b/pyproj/datadir.py 2020-03-24 12:56:19.870089479 +0100 +++ b/pyproj/datadir.py 2021-04-10 18:44:59.155190614 +0100
@@ -66,9 +66,7 @@ @@ -70,7 +70,7 @@
if _VALIDATED_PROJ_DATA is not None: if _VALIDATED_PROJ_DATA is not None:
return _VALIDATED_PROJ_DATA return _VALIDATED_PROJ_DATA
global _USER_PROJ_DATA global _USER_PROJ_DATA
- internal_datadir = os.path.join( - internal_datadir = Path(__file__).absolute().parent / "proj_dir" / "share" / "proj"
- os.path.dirname(os.path.abspath(__file__)), "proj_dir", "share", "proj" + internal_datadir = Path("@proj@/share/proj")
- )
+ internal_datadir = "@proj@/share/proj"
proj_lib_dirs = os.environ.get("PROJ_LIB", "") proj_lib_dirs = os.environ.get("PROJ_LIB", "")
prefix_datadir = os.path.join(sys.prefix, "share", "proj") prefix_datadir = Path(sys.prefix, "share", "proj")
diff -Nur a/setup.py b/setup.py diff -Nur a/setup.py b/setup.py
--- a/setup.py 2020-03-24 12:53:39.415440624 +0100 --- a/setup.py 2021-04-10 18:26:52.817018512 +0100
+++ b/setup.py 2020-03-24 12:52:05.311232522 +0100 +++ b/setup.py 2021-04-10 18:46:01.652324424 +0100
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
PROJ_MIN_VERSION = parse_version("6.2.0") PROJ_MIN_VERSION = parse_version("7.2.0")
CURRENT_FILE_PATH = os.path.dirname(os.path.abspath(__file__)) CURRENT_FILE_PATH = Path(__file__).absolute().parent
BASE_INTERNAL_PROJ_DIR = "proj_dir" BASE_INTERNAL_PROJ_DIR = Path("proj_dir")
-INTERNAL_PROJ_DIR = os.path.join(CURRENT_FILE_PATH, "pyproj", BASE_INTERNAL_PROJ_DIR) -INTERNAL_PROJ_DIR = CURRENT_FILE_PATH / "pyproj" / BASE_INTERNAL_PROJ_DIR
+INTERNAL_PROJ_DIR = "@proj@" +INTERNAL_PROJ_DIR = Path("@proj@")
def check_proj_version(proj_dir): def get_proj_version(proj_dir: Path) -> str:
@@ -146,7 +146,7 @@ @@ -150,7 +150,7 @@
# By default we'll try to get options PROJ_DIR or the local version of proj # By default we'll try to get options PROJ_DIR or the local version of proj
proj_dir = get_proj_dir() proj_dir = get_proj_dir()
library_dirs = get_proj_libdirs(proj_dir) library_dirs = get_proj_libdirs(proj_dir)
- include_dirs = get_proj_incdirs(proj_dir) - include_dirs = get_proj_incdirs(proj_dir)
+ include_dirs = get_proj_incdirs("@projdev@") + include_dirs = get_proj_incdirs(Path("@projdev@"))
# setup extension options proj_version = get_proj_version(proj_dir)
ext_options = { check_proj_version(proj_version)
diff -Nur a/test/conftest.py b/test/conftest.py diff -Nur a/test/conftest.py b/test/conftest.py
--- a/test/conftest.py 2020-03-24 12:53:39.417440608 +0100 --- a/test/conftest.py 2021-04-10 18:26:52.831018478 +0100
+++ b/test/conftest.py 2020-03-24 23:16:47.373972786 +0100 +++ b/test/conftest.py 2021-04-10 18:37:01.605682432 +0100
@@ -1,6 +1,7 @@ @@ -2,6 +2,7 @@
import os from contextlib import contextmanager
import shutil from distutils.version import LooseVersion
import tempfile from pathlib import Path
+import stat +import stat
import pytest import pyproj
from pyproj.datadir import get_data_dir, get_user_data_dir, set_data_dir
diff -Nur a/test/test_cli.py b/test/test_cli.py
--- a/test/test_cli.py 2021-04-10 18:26:52.831018478 +0100
+++ b/test/test_cli.py 2021-04-10 22:17:04.665088162 +0100
@@ -14,7 +14,7 @@
from test.conftest import grids_available, proj_env, tmp_chdir
PYPROJ_CLI_ENDPONTS = pytest.mark.parametrize(
- "input_command", [["pyproj"], [sys.executable, "-m", "pyproj"]]
+ "input_command", [[sys.executable, "-m", "pyproj"]]
)
@@ -17,6 +18,15 @@
with tempfile.TemporaryDirectory() as tmpdir:
tmp_data_dir = os.path.join(tmpdir, "proj")
shutil.copytree(data_dir, tmp_data_dir)
+
+ # Data copied from the nix store is readonly (causes cleanup problem).
+ # Make it writable.
+ for r, d, files in os.walk(tmp_data_dir):
+ os.chmod(r, os.stat(r).st_mode | stat.S_IWUSR)
+ for f in files:
+ fpath = os.path.join(r, f)
+ os.chmod(fpath, os.stat(fpath).st_mode | stat.S_IWUSR)
+
try:
os.remove(os.path.join(str(tmp_data_dir), "ntv2_0.gsb"))
except OSError:

View File

@ -1,60 +1,94 @@
{ lib, buildPythonPackage, fetchFromGitHub, python, pkgs, pythonOlder, isPy27, substituteAll { lib
, aenum , buildPythonPackage
, fetchFromGitHub
, python
, proj
, pythonOlder
, substituteAll
, cython , cython
, pytestCheckHook , pytestCheckHook
, mock , mock
, certifi
, numpy , numpy
, shapely , shapely
, pandas
, xarray
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "pyproj"; pname = "pyproj";
version = "2.6.0"; version = "3.0.1";
disabled = isPy27; disabled = pythonOlder "3.7";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "pyproj4"; owner = "pyproj4";
repo = "pyproj"; repo = "pyproj";
rev = "v${version}rel"; rev = version;
sha256 = "0fyggkbr3kp8mlq4c0r8sl5ah58bdg2mj4kzql9p3qyrkcdlgixh"; sha256 = "1q1i1235cp3k32dpb11r7krx5rpqwszb89mrx85rflc1z5acaj58";
}; };
# force pyproj to use ${pkgs.proj} # force pyproj to use ${proj}
patches = [ patches = [
(substituteAll { (substituteAll {
src = ./001.proj.patch; src = ./001.proj.patch;
proj = pkgs.proj; proj = proj;
projdev = pkgs.proj.dev; projdev = proj.dev;
}) })
]; ];
buildInputs = [ cython pkgs.proj ]; nativeBuildInputs = [ cython ];
buildInputs = [ proj ];
propagatedBuildInputs = [ propagatedBuildInputs = [
numpy shapely certifi
] ++ lib.optional (pythonOlder "3.6") aenum; ];
checkInputs = [ pytestCheckHook mock ]; checkInputs = [
pytestCheckHook
mock
numpy
shapely
pandas
xarray
];
# prevent importing local directory preCheck = ''
preCheck = "cd test"; # We need to build extensions locally to run tests
pytestFlagsArray = [ ${python.interpreter} setup.py build_ext --inplace
"--ignore=test_doctest_wrapper.py" cd test
"--ignore=test_datadir.py" '';
disabledTestPaths = [
"test_doctest_wrapper.py"
"test_datadir.py"
]; ];
disabledTests = [ disabledTests = [
"alternative_grid_name" # The following tests try to access network and end up with a URLError
"transform_wgs84_to_alaska" "test__load_grid_geojson_old_file"
"transformer_group__unavailable" "test_get_transform_grid_list"
"transform_group__missing_best" "test_get_transform_grid_list__area_of_use"
"datum" "test_get_transform_grid_list__bbox__antimeridian"
"repr" "test_get_transform_grid_list__bbox__out_of_bounds"
"test_get_transform_grid_list__contains"
"test_get_transform_grid_list__file"
"test_get_transform_grid_list__source_id"
"test_sync__area_of_use__list"
"test_sync__bbox__list"
"test_sync__bbox__list__exclude_world_coverage"
"test_sync__download_grids"
"test_sync__file__list"
"test_sync__source_id__list"
"test_sync_download"
"test_sync_download__directory"
"test_sync_download__system_directory"
"test_transformer_group__download_grids"
]; ];
meta = { meta = {
description = "Python interface to PROJ.4 library"; description = "Python interface to PROJ.4 library";
homepage = "https://github.com/jswhit/pyproj"; homepage = "https://github.com/pyproj4/pyproj";
license = with lib.licenses; [ isc ]; license = with lib.licenses; [ isc ];
maintainers = with lib.maintainers; [ lsix ];
}; };
} }

View File

@ -578,6 +578,7 @@ mapAliases ({
ppl-address-book = throw "ppl-address-book deprecated on 2019-05-02: abandoned by upstream."; ppl-address-book = throw "ppl-address-book deprecated on 2019-05-02: abandoned by upstream.";
processing3 = processing; # added 2019-08-16 processing3 = processing; # added 2019-08-16
procps-ng = procps; # added 2018-06-08 procps-ng = procps; # added 2018-06-08
proj_5 = throw "Proj-5 has been removed from nixpkgs, use proj instead."; # added 2021-04-12
prometheus-cups-exporter = throw "outdated and broken by design; removed by developer."; # added 2021-03-16 prometheus-cups-exporter = throw "outdated and broken by design; removed by developer."; # added 2021-03-16
pygmentex = texlive.bin.pygmentex; # added 2019-12-15 pygmentex = texlive.bin.pygmentex; # added 2019-12-15
pyload = throw "pyload has been removed from nixpkgs, as it was unmaintained."; # added 2021-03-21 pyload = throw "pyload has been removed from nixpkgs, as it was unmaintained."; # added 2021-03-21

View File

@ -16861,8 +16861,6 @@ in
proj = callPackage ../development/libraries/proj { }; proj = callPackage ../development/libraries/proj { };
proj_5 = callPackage ../development/libraries/proj/5.2.nix { };
proj-datumgrid = callPackage ../development/libraries/proj-datumgrid { }; proj-datumgrid = callPackage ../development/libraries/proj-datumgrid { };
proselint = callPackage ../tools/text/proselint { proselint = callPackage ../tools/text/proselint {