1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, fetchpatch
6, scikit-build-core
7, pybind11
8, cmake
9, LASzip
10, ninja
11, pythonOlder
12}:
13
14buildPythonPackage rec {
15 pname = "laszip-python";
16 version = "0.2.3";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "tmontaigu";
23 repo = pname;
24 rev = version;
25 hash = "sha256-MiPzL9TDCf1xnCv7apwdfcpkFnBRi4PO/atTQxqL8cw=";
26 };
27
28 patches = [
29 # Removes depending on the cmake and ninja PyPI packages, since we can pass
30 # in the tools directly, and scikit-build-core can use them.
31 # https://github.com/tmontaigu/laszip-python/pull/9
32 (fetchpatch {
33 name = "remove-cmake-ninja-pypi-dependencies.patch";
34 url = "https://github.com/tmontaigu/laszip-python/commit/17e648d04945fa2d095d6d74d58c790a4fcde84a.patch";
35 hash = "sha256-k58sS1RqVzT1WPh2OVt/D4Y045ODtj6U3bUjegd44VY=";
36 })
37 ];
38
39 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-std=c++17";
40
41 nativeBuildInputs = [
42 cmake
43 ninja
44 pybind11
45 scikit-build-core
46 ] ++ scikit-build-core.optional-dependencies.pyproject;
47
48 dontUseCmakeConfigure = true;
49
50 buildInputs = [
51 LASzip
52 ];
53
54 # There are no tests
55 doCheck = false;
56
57 pythonImportsCheck = [ "laszip" ];
58
59 meta = with lib; {
60 description = "Unofficial bindings between Python and LASzip made using pybind11";
61 homepage = "https://github.com/tmontaigu/laszip-python";
62 changelog = "https://github.com/tmontaigu/laszip-python/blob/${src.rev}/Changelog.md";
63 license = licenses.mit;
64 maintainers = with maintainers; [ matthewcroughan ];
65 };
66}
67