depot/third_party/nixpkgs/pkgs/development/python-modules/json-stream-rs-tokenizer/default.nix
Default email 94427deb9d Project import generated by Copybara.
GitOrigin-RevId: f91ee3065de91a3531329a674a45ddcb3467a650
2023-05-24 16:37:59 +03:00

69 lines
1.5 KiB
Nix

{ lib
, stdenv
, buildPythonPackage
, fetchFromGitHub
, rustPlatform
, cargo
, darwin
, rustc
, setuptools-rust
, json-stream-rs-tokenizer
, json-stream
}:
buildPythonPackage rec {
pname = "json-stream-rs-tokenizer";
version = "0.4.16";
format = "setuptools";
src = fetchFromGitHub {
owner = "smheidrich";
repo = "py-json-stream-rs-tokenizer";
rev = "refs/tags/v${version}";
hash = "sha256-MnYkCAI8x65kU0EoTRf4ZVsbjNravjokepX4yViu7go=";
};
postPatch = ''
cp ${./Cargo.lock} ./Cargo.lock
'';
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src postPatch;
name = "${pname}-${version}";
hash = "sha256-HwWH8/UWKWOdRmyCVQtNqJxXD55f6zxLY0LhR7JU9ro=";
};
nativeBuildInputs = [
setuptools-rust
rustPlatform.cargoSetupHook
cargo
rustc
];
buildInputs = lib.optionals stdenv.isDarwin [
darwin.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 = "A 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 ];
};
}