From 4fea9b89ed2445cff4107def8980f008bf287713 Mon Sep 17 00:00:00 2001 From: Nikolay Korotkiy Date: Sat, 8 Feb 2025 18:56:22 +0400 Subject: [PATCH] =?UTF-8?q?python312Packages.h3:=204.1.2=20=E2=86=92=204.2?= =?UTF-8?q?.1,=20fix=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../development/python-modules/h3/default.nix | 32 ++++++++++++------- pkgs/top-level/python-packages.nix | 2 +- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/pkgs/development/python-modules/h3/default.nix b/pkgs/development/python-modules/h3/default.nix index 4db7e9dda9e6..078c2ee8c55d 100644 --- a/pkgs/development/python-modules/h3/default.nix +++ b/pkgs/development/python-modules/h3/default.nix @@ -6,34 +6,40 @@ fetchFromGitHub, h3, lib, + ninja, numpy, pytestCheckHook, - scikit-build, + pytest-cov-stub, + scikit-build-core, stdenv, }: buildPythonPackage rec { pname = "h3"; - version = "4.1.2"; - format = "setuptools"; + version = "4.2.1"; + pyproject = true; # pypi version does not include tests src = fetchFromGitHub { owner = "uber"; repo = "h3-py"; tag = "v${version}"; - hash = "sha256-dsF6VJwwIDapHtLiNEWbKW6A28zEOWqEPDRznf0eOcA="; + hash = "sha256-YFGKF/WV0nlmtR7MacOBoor6PQwPPFqdK1C1eIciXwI="; }; dontConfigure = true; - nativeCheckInputs = [ pytestCheckHook ]; + nativeCheckInputs = [ + pytestCheckHook + pytest-cov-stub + ]; - nativeBuildInputs = + build-system = [ - scikit-build + scikit-build-core cmake cython + ninja ] ++ lib.optionals stdenv.hostPlatform.isLinux [ # On Linux the .so files ends up referring to libh3.so instead of the full @@ -46,7 +52,7 @@ buildPythonPackage rec { # correctly. See the note above ^^ buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ h3 ]; - propagatedBuildInputs = [ numpy ]; + dependencies = [ numpy ]; # The following prePatch replaces the h3lib compilation with using the h3 packaged in nixpkgs. # @@ -61,16 +67,18 @@ buildPythonPackage rec { in '' rm -r src/h3lib - substituteInPlace CMakeLists.txt --replace "add_subdirectory(src/h3lib)" "${cmakeCommands}" + substituteInPlace CMakeLists.txt \ + --replace-fail "add_subdirectory(src/h3lib)" "${cmakeCommands}" \ + --replace-fail "\''${CMAKE_CURRENT_BINARY_DIR}/src/h3lib/src/h3lib/include/h3api.h" "${lib.getDev h3}/include/h3/h3api.h" ''; # Extra check to make sure we can import it from Python pythonImportsCheck = [ "h3" ]; - meta = with lib; { + meta = { homepage = "https://github.com/uber/h3-py"; description = "Hierarchical hexagonal geospatial indexing system"; - license = licenses.asl20; - maintainers = [ maintainers.kalbasit ]; + license = lib.licenses.asl20; + maintainers = [ lib.maintainers.kalbasit ]; }; } diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 7c3c4089b8c3..8fa9970c21b2 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5791,7 +5791,7 @@ self: super: with self; { h2 = callPackage ../development/python-modules/h2 { }; h3 = callPackage ../development/python-modules/h3 { - inherit (pkgs) h3; + h3 = pkgs.h3_4; }; h5io = callPackage ../development/python-modules/h5io { };