Martin Weinelt ae4a1a485a
treewide: add explicit format attribute for Python packages
If a Python package does not come with either `format` or `pyproject` we
consider it a setuptools build, that calls `setup.py` directly, which is
deprecated.

This change, as a first step, migrates a large chunk of these packages to
set setuptools as their explicit format

This is so we can unify the problem space for the next step of the
migration.
2025-07-02 05:56:47 +02:00

71 lines
1.4 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
cargo,
libiconv,
rustPlatform,
rustc,
sudachi-rs,
setuptools-rust,
pytestCheckHook,
sudachidict-core,
tokenizers,
sudachipy,
}:
buildPythonPackage rec {
format = "setuptools";
pname = "sudachipy";
inherit (sudachi-rs) src version;
patches = sudachi-rs.cargoPatches;
cargoDeps = rustPlatform.fetchCargoVendor {
inherit pname version src;
patches = sudachi-rs.cargoPatches;
hash = "sha256-lUP/9s4W0JehxeCjMmq6G22KMGdDNnq1YlobeLQn2AE=";
};
nativeBuildInputs = [
cargo
rustPlatform.cargoSetupHook
rustc
setuptools-rust
];
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
preBuild = ''
cd python
'';
# avoid infinite recursion due to sudachidict
doCheck = false;
nativeCheckInputs = [
pytestCheckHook
sudachidict-core
tokenizers
];
pythonImportsCheck = [ "sudachipy" ];
passthru = {
inherit (sudachi-rs) updateScript;
tests = {
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;
});
};
};
meta = sudachi-rs.meta // {
homepage = "https://github.com/WorksApplications/sudachi.rs/tree/develop/python";
mainProgram = "sudachipy";
};
}