1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 maturin,
6 pythonOlder,
7 rustPlatform,
8 rustc,
9 cargo,
10 semantic-version,
11 setuptools,
12 setuptools-rust,
13 setuptools-scm,
14}:
15
16buildPythonPackage rec {
17 pname = "setuptools-rust";
18 version = "1.12.0";
19 format = "pyproject";
20
21 disabled = pythonOlder "3.6";
22
23 src = fetchPypi {
24 pname = "setuptools_rust";
25 inherit version;
26 hash = "sha256-2UqT8Ml3UcFwFFZfB73DJL7kXTls0buoPY56+SuUXww=";
27 };
28
29 build-system = [
30 setuptools
31 setuptools-scm
32 ];
33
34 dependencies = [
35 semantic-version
36 setuptools
37 ];
38
39 pythonImportsCheck = [ "setuptools_rust" ];
40
41 doCheck = false;
42
43 passthru.tests = {
44 pyo3 = maturin.tests.pyo3.override {
45 format = "setuptools";
46 buildAndTestSubdir = null;
47
48 nativeBuildInputs = [
49 setuptools-rust
50 ]
51 ++ [
52 rustPlatform.cargoSetupHook
53 cargo
54 rustc
55 ];
56
57 preConfigure = ''
58 # sourceRoot puts Cargo.lock in the wrong place due to the
59 # example setup.
60 cd examples/word-count
61 '';
62 };
63 };
64
65 meta = with lib; {
66 description = "Setuptools plugin for Rust support";
67 homepage = "https://github.com/PyO3/setuptools-rust";
68 changelog = "https://github.com/PyO3/setuptools-rust/releases/tag/v${version}";
69 license = licenses.mit;
70 maintainers = [ ];
71 };
72}