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