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