Unverified Commit 4fea9b89 authored by Nikolay Korotkiy's avatar Nikolay Korotkiy
Browse files

python312Packages.h3: 4.1.2 → 4.2.1, fix build

parent 7aa159d1
Loading
Loading
Loading
Loading
+20 −12
Original line number Diff line number Diff line
@@ -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 ];
  };
}
+1 −1
Original line number Diff line number Diff line
@@ -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 { };