Files
nixpkgs/pkgs/development/python-modules/json-stream-rs-tokenizer/default.nix
T
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

71 lines
1.5 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
cargo,
libiconv,
fetchFromGitHub,
json-stream,
json-stream-rs-tokenizer,
pythonOlder,
rustc,
rustPlatform,
setuptools,
setuptools-rust,
wheel,
}:
buildPythonPackage rec {
pname = "json-stream-rs-tokenizer";
version = "0.4.26";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "smheidrich";
repo = "py-json-stream-rs-tokenizer";
rev = "refs/tags/v${version}";
hash = "sha256-ogX0KsfHRQW7+exRMKGwJiNINrOKPiTKxAqiTZyEWrg=";
};
cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
outputHashes = {
"utf8-read-0.4.0" = "sha256-L/NcgbB+2Rwtc+1e39fQh1D9S4RqQY6CCFOTh8CI8Ts=";
};
};
nativeBuildInputs = [
cargo
rustPlatform.cargoSetupHook
rustc
setuptools
setuptools-rust
wheel
];
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
# Tests depend on json-stream, which depends on this package.
# To avoid infinite recursion, we only enable tests when building passthru.tests.
doCheck = false;
checkInputs = [ json-stream ];
pythonImportsCheck = [ "json_stream_rs_tokenizer" ];
passthru.tests = {
runTests = json-stream-rs-tokenizer.overrideAttrs (_: {
doCheck = true;
});
};
meta = with lib; {
description = "Faster tokenizer for the json-stream Python library";
homepage = "https://github.com/smheidrich/py-json-stream-rs-tokenizer";
license = licenses.mit;
maintainers = with maintainers; [ winter ];
};
}