nixpkgs/pkgs/development/python-modules/shapely/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

70 lines
1.5 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
fetchPypi,
pytestCheckHook,
pythonOlder,
cython_0,
geos,
numpy,
oldest-supported-numpy,
setuptools,
wheel,
}:
buildPythonPackage rec {
pname = "shapely";
version = "2.0.6";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
hash = "sha256-mX9hWbFIQFnsI5ysqlNGf9i1Vk2r4YbNhKwpRGY7C/Y=";
};
nativeBuildInputs = [
cython_0
geos # for geos-config
oldest-supported-numpy
setuptools
wheel
];
buildInputs = [ geos ];
propagatedBuildInputs = [ numpy ];
nativeCheckInputs = [ pytestCheckHook ];
# Fix a ModuleNotFoundError. Investigated at:
# https://github.com/NixOS/nixpkgs/issues/255262
preCheck = ''
cd $out
'';
disabledTests = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
# FIXME(lf-): these logging tests are broken, which is definitely our
# fault. I've tried figuring out the cause and failed.
#
# It is apparently some sandbox or no-sandbox related thing on macOS only
# though.
"test_error_handler_exception"
"test_error_handler"
"test_info_handler"
];
pythonImportsCheck = [ "shapely" ];
meta = with lib; {
changelog = "https://github.com/shapely/shapely/blob/${version}/CHANGES.txt";
description = "Manipulation and analysis of geometric objects";
homepage = "https://github.com/shapely/shapely";
license = licenses.bsd3;
maintainers = teams.geospatial.members;
};
}