2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
cargo,
|
|
|
|
libiconv,
|
|
|
|
rustPlatform,
|
|
|
|
rustc,
|
|
|
|
sudachi-rs,
|
|
|
|
setuptools-rust,
|
|
|
|
pytestCheckHook,
|
|
|
|
sudachidict-core,
|
|
|
|
tokenizers,
|
|
|
|
sudachipy,
|
2024-01-02 11:29:13 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "sudachipy";
|
|
|
|
inherit (sudachi-rs) src version;
|
|
|
|
|
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-${version}";
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "sha256-ARwvThfATDdzBTjPFr9yjbE/0eYvp/TCZOEGbUupJmU=";
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cargo
|
|
|
|
rustPlatform.cargoSetupHook
|
|
|
|
rustc
|
|
|
|
setuptools-rust
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
cd python
|
|
|
|
'';
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
# avoid infinite recursion due to sudachidict
|
|
|
|
doCheck = false;
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
sudachidict-core
|
|
|
|
tokenizers
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "sudachipy" ];
|
2024-01-02 11:29:13 +00:00
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
passthru = {
|
|
|
|
inherit (sudachi-rs) updateScript;
|
|
|
|
tests = {
|
2024-06-05 15:53:02 +00:00
|
|
|
pytest = sudachipy.overridePythonAttrs (_: {
|
|
|
|
doCheck = true;
|
|
|
|
# avoid catchConflicts of sudachipy
|
|
|
|
# we don't need to install this package since it is just a test
|
|
|
|
dontInstall = true;
|
|
|
|
});
|
2024-01-25 14:12:00 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
meta = sudachi-rs.meta // {
|
|
|
|
homepage = "https://github.com/WorksApplications/sudachi.rs/tree/develop/python";
|
|
|
|
mainProgram = "sudachipy";
|
|
|
|
};
|
|
|
|
}
|