1{ lib
2, buildPythonPackage
3, cargo
4, fetchFromGitHub
5, libiconv
6, pytestCheckHook
7, pythonOlder
8, rustPlatform
9, rustc
10, setuptools-rust
11}:
12
13buildPythonPackage rec {
14 pname = "rtoml";
15 version = "0.8";
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "samuelcolvin";
21 repo = pname;
22 rev = "v${version}";
23 hash = "sha256-tvX4KcQGw0khBjEXVFmkhsVyAkdr2Bgm6IfD1yGZ37c=";
24 };
25
26 cargoDeps = rustPlatform.fetchCargoTarball {
27 inherit src;
28 name = "${pname}-${version}";
29 hash = "sha256-KcF3Z71S7ZNZicViqwpClfT736nYYbKcKWylOP+S3HI=";
30 };
31
32 nativeBuildInputs = with rustPlatform; [
33 setuptools-rust
34 rustc
35 cargo
36 rustPlatform.cargoSetupHook
37 ];
38
39 buildInputs = [
40 libiconv
41 ];
42
43 pythonImportsCheck = [
44 "rtoml"
45 ];
46
47 nativeCheckInputs = [
48 pytestCheckHook
49 ];
50
51 preCheck = ''
52 cd tests
53 '';
54
55 meta = with lib; {
56 description = "Rust based TOML library for Python";
57 homepage = "https://github.com/samuelcolvin/rtoml";
58 license = licenses.mit;
59 maintainers = with maintainers; [ evils ];
60 };
61}