2023-03-15 16:39:30 +00:00
|
|
|
{ lib
|
2023-05-24 13:37:59 +00:00
|
|
|
, stdenv
|
2023-03-15 16:39:30 +00:00
|
|
|
, buildPythonPackage
|
2023-05-24 13:37:59 +00:00
|
|
|
, cargo
|
|
|
|
, darwin
|
2023-08-22 20:05:09 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, json-stream
|
|
|
|
, json-stream-rs-tokenizer
|
2023-05-24 13:37:59 +00:00
|
|
|
, rustc
|
2023-08-22 20:05:09 +00:00
|
|
|
, rustPlatform
|
|
|
|
, setuptools
|
2023-03-15 16:39:30 +00:00
|
|
|
, setuptools-rust
|
2023-08-22 20:05:09 +00:00
|
|
|
, wheel
|
2023-03-15 16:39:30 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "json-stream-rs-tokenizer";
|
2023-08-22 20:05:09 +00:00
|
|
|
version = "0.4.22";
|
2023-03-15 16:39:30 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "smheidrich";
|
|
|
|
repo = "py-json-stream-rs-tokenizer";
|
|
|
|
rev = "refs/tags/v${version}";
|
2023-08-22 20:05:09 +00:00
|
|
|
hash = "sha256-EW726gUXTBX3gTxlFQ45RgkUa2Z4tIjUZxO4GBLXgEs=";
|
2023-03-15 16:39:30 +00:00
|
|
|
};
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
cargoDeps = rustPlatform.importCargoLock {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
|
|
|
"utf8-read-0.4.0" = "sha256-L/NcgbB+2Rwtc+1e39fQh1D9S4RqQY6CCFOTh8CI8Ts=";
|
|
|
|
};
|
2023-03-15 16:39:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2023-05-24 13:37:59 +00:00
|
|
|
cargo
|
2023-08-22 20:05:09 +00:00
|
|
|
rustPlatform.cargoSetupHook
|
2023-05-24 13:37:59 +00:00
|
|
|
rustc
|
2023-08-22 20:05:09 +00:00
|
|
|
setuptools
|
|
|
|
setuptools-rust
|
|
|
|
wheel
|
2023-05-24 13:37:59 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [
|
|
|
|
darwin.libiconv
|
|
|
|
];
|
2023-03-15 16:39:30 +00:00
|
|
|
|
|
|
|
# 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 ];
|
|
|
|
};
|
|
|
|
}
|