nixpkgs/pkgs/development/python-modules/cramjam/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

66 lines
1.4 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
rustPlatform,
stdenv,
libiconv,
hypothesis,
numpy,
pytest-xdist,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "cramjam";
version = "2.8.3";
pyproject = true;
src = fetchFromGitHub {
owner = "milesgranger";
repo = "pyrus-cramjam";
rev = "refs/tags/v${version}";
hash = "sha256-1KD5/oZjfdXav1ZByQoyyiDSzbmY4VJsSJg/FtUFdDE=";
};
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
hash = "sha256-Bp7EtyuLdLUfU3yvouNVE42klfqYt9QOwt+iGe521yI=";
};
buildAndTestSubdir = "cramjam-python";
nativeBuildInputs = with rustPlatform; [
cargoSetupHook
maturinBuildHook
];
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libiconv;
nativeCheckInputs = [
hypothesis
numpy
pytest-xdist
pytestCheckHook
];
pytestFlagsArray = [ "cramjam-python/tests" ];
disabledTestPaths = [
"cramjam-python/benchmarks/test_bench.py"
# test_variants.py appears to be flaky
#
# https://github.com/NixOS/nixpkgs/pull/311584#issuecomment-2117656380
"cramjam-python/tests/test_variants.py"
];
pythonImportsCheck = [ "cramjam" ];
meta = with lib; {
description = "Thin Python bindings to de/compression algorithms in Rust";
homepage = "https://github.com/milesgranger/pyrus-cramjam";
license = with licenses; [ mit ];
maintainers = with maintainers; [ veprbl ];
};
}