Unverified Commit 46a8c22a authored by kirillrdy's avatar kirillrdy Committed by GitHub
Browse files

python3Packages.laspy: cleanup, fix build (#494196)

parents 1dd78bc4 94da6aae
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ stdenv.mkDerivation (finalAttrs: {
  src = fetchFromGitHub {
    owner = "LASzip";
    repo = "LASzip";
    rev = finalAttrs.version;
    tag = finalAttrs.version;
    hash = "sha256-v/oLU69zqDW1o1HTlay7GDh1Kbmv1rarII2Fz5HWCqg=";
  };

@@ -29,7 +29,7 @@ stdenv.mkDerivation (finalAttrs: {
  meta = {
    description = "Turn quickly bulky LAS files into compact LAZ files without information loss";
    homepage = "https://laszip.org";
    changelog = "https://github.com/LASzip/LASzip/releases/tag/${finalAttrs.src.rev}";
    changelog = "https://github.com/LASzip/LASzip/releases/tag/${finalAttrs.src.tag}";
    license = lib.licenses.lgpl2;
    maintainers = [ ];
    platforms = lib.platforms.unix;
+23 −13
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,
  numpy,
  fetchFromGitHub,

  # build-system
  hatchling,

  # depenencies
  laszip,
  lazrs,
  setuptools,
  numpy,

  # tests
  pytestCheckHook,
}:

buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
  pname = "laspy";
  version = "2.7.0";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-9W/rVEXnXW/xLugUqrajUzkpDnUmT/J3xr9VPzAlo/U=";
  src = fetchFromGitHub {
    owner = "laspy";
    repo = "laspy";
    tag = finalAttrs.version;
    hash = "sha256-/wvwUE+lzBgAZVtLB05Fpuq0ElajMxWqCIa1Y3sjB5k=";
  };

  nativeBuildInputs = [ setuptools ];
  build-system = [ hatchling ];

  propagatedBuildInputs = [
  dependencies = [
    numpy
    laszip
    lazrs # much faster laz reading, see https://laspy.readthedocs.io/en/latest/installation.html#laz-support
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [
    "laspy"
    # `laspy` supports multiple backends and detects them dynamically.
@@ -37,13 +43,17 @@ buildPythonPackage rec {
    "lazrs"
  ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  meta = {
    description = "Interface for reading/modifying/creating .LAS LIDAR files";
    mainProgram = "laspy";
    homepage = "https://github.com/laspy/laspy";
    changelog = "https://github.com/laspy/laspy/blob/${version}/CHANGELOG.md";
    changelog = "https://github.com/laspy/laspy/blob/${finalAttrs.version}/CHANGELOG.md";
    license = lib.licenses.bsd2;
    maintainers = with lib.maintainers; [ matthewcroughan ];
    teams = [ lib.teams.geospatial ];
  };
}
})
+12 −23
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch,

  # build-system
  scikit-build-core,
  pybind11,
  cmake,
  laszip,
  ninja,

  # buildInputs
  laszip,
}:

buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
  pname = "laszip-python";
  version = "0.2.3";
  version = "0.3.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "tmontaigu";
    repo = "laszip-python";
    rev = version;
    hash = "sha256-MiPzL9TDCf1xnCv7apwdfcpkFnBRi4PO/atTQxqL8cw=";
    tag = finalAttrs.version;
    hash = "sha256-fg9Joe5iDNT4w2j+zQuQIoxyAYpCAgLwhuqsBsJn6lU=";
  };

  patches = [
    # Removes depending on the cmake and ninja PyPI packages, since we can pass
    # in the tools directly, and scikit-build-core can use them.
    # https://github.com/tmontaigu/laszip-python/pull/9
    (fetchpatch {
      name = "remove-cmake-ninja-pypi-dependencies.patch";
      url = "https://github.com/tmontaigu/laszip-python/commit/17e648d04945fa2d095d6d74d58c790a4fcde84a.patch";
      hash = "sha256-k58sS1RqVzT1WPh2OVt/D4Y045ODtj6U3bUjegd44VY=";
    })
  ];

  env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-std=c++17";

  nativeBuildInputs = [
  build-system = [
    cmake
    ninja
    pybind11
@@ -55,8 +44,8 @@ buildPythonPackage rec {
  meta = {
    description = "Unofficial bindings between Python and LASzip made using pybind11";
    homepage = "https://github.com/tmontaigu/laszip-python";
    changelog = "https://github.com/tmontaigu/laszip-python/blob/${src.rev}/Changelog.md";
    changelog = "https://github.com/tmontaigu/laszip-python/blob/${finalAttrs.src.tag}/Changelog.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ matthewcroughan ];
  };
}
})
+6 −11
Original line number Diff line number Diff line
{
  lib,
  fetchpatch2,
  fetchFromGitLab,
  addBinToPathHook,

@@ -47,21 +46,17 @@ buildPythonPackage (finalAttrs: {
    hash = "sha256-m8c+g9XXbg9OSC+NNoQkw4RKXvNFRIPWkDjAs6oH3kc=";
  };

  patches = [
    # Remove in the next version
    # Patch to avoid using pythonRelaxDeps
    (fetchpatch2 {
      url = "https://gitlab.com/py3dtiles/py3dtiles/-/commit/0f60691434b9ad4afebec29b2eedfcbbe0b8420d.patch";
      includes = [ "pyproject.toml" ];
      hash = "sha256-TLoKeltI1xxSONX0uu56HKl2fXzAp1ufunsBPRr5Pus=";
    })
  ];

  build-system = [
    setuptools
    setuptools-scm
  ];

  pythonRelaxDeps = [
    "mapbox_earcut"
    "numba"
    "numpy"
    "pyzmq"
  ];
  dependencies = [
    lz4
    mapbox-earcut