Commit a3d4328f authored by Patrick Chilton's avatar Patrick Chilton
Browse files

python311Packages.kornia-rs: init at 0.1.2

parent 249a78b2
Loading
Loading
Loading
Loading
+1598 −0

File added.

Preview size limit exceeded, changes collapsed.

+56 −0
Original line number Diff line number Diff line
{ lib
, fetchFromGitHub
, buildPythonPackage
, rustPlatform
, cmake
, nasm
, substituteAll
}:

buildPythonPackage rec {
  pname = "kornia-rs";
  version = "0.1.2";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "kornia";
    repo = "kornia-rs";
    rev = "refs/tags/v${version}";
    hash = "sha256-7toCMaHzFAzm6gThVLBxKLgQVgFJatdJseDlfdeS8RE=";
  };

  nativeBuildInputs = [
    rustPlatform.maturinBuildHook
    rustPlatform.cargoSetupHook
    cmake # Only for dependencies.
    nasm # Only for dependencies.
  ];

  cargoRoot = "py-kornia";
  cargoDeps = rustPlatform.importCargoLock {
    lockFile = ./Cargo.lock;
  };

  # The path dependency doesn't vendor the dependencies correctly, so get kornia-rs from crates instead.
  patches = [
    (substituteAll {
      src = ./kornia-rs-from-crates.patch;
      inherit version;
    })
  ];

  prePatch = ''
    cp ${./Cargo.lock} py-kornia/Cargo.lock
  '';

  maturinBuildFlags = [ "-m" "py-kornia/Cargo.toml" ];

  dontUseCmakeConfigure = true; # We only want to use CMake to build some Rust dependencies.

  meta = with lib; {
    homepage = "https://github.com/kornia/kornia-rs";
    description = "Python bindings to Low-level Computer Vision library in Rust";
    license = licenses.asl20;
    maintainers = with maintainers; [ chpatrick ];
  };
}
+12 −0
Original line number Diff line number Diff line
diff --git a/py-kornia/Cargo.toml b/py-kornia/Cargo.toml
index e0563f3..e192654 100644
--- a/py-kornia/Cargo.toml
+++ b/py-kornia/Cargo.toml
@@ -9,6 +9,6 @@ crate-type = ["cdylib"]

 [dependencies]
 anyhow = "1.0.80"
-kornia-rs = { path = ".." }
+kornia-rs = { version = "@version@" }
 pyo3 = { version = "0.20", features = ["extension-module"] }
 numpy = { version = "0.20.0" }
+2 −0
Original line number Diff line number Diff line
@@ -6380,6 +6380,8 @@ self: super: with self; {
  kornia = callPackage ../development/python-modules/kornia { };
  kornia-rs = callPackage ../development/python-modules/kornia-rs { };
  krakenex = callPackage ../development/python-modules/krakenex { };
  krfzf-py = callPackage ../development/python-modules/krfzf-py { };