1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 rustPlatform,
6
7 # buildInputs
8 libiconv,
9
10 # build-system
11 cargo,
12 poetry-core,
13 rustc,
14
15 # dependencies
16 packaging,
17
18 # tests
19 pytestCheckHook,
20}:
21
22buildPythonPackage rec {
23 pname = "python-calamine";
24 version = "0.2.3";
25 pyproject = true;
26
27 src = fetchFromGitHub {
28 owner = "dimastbk";
29 repo = "python-calamine";
30 rev = "refs/tags/v${version}";
31 hash = "sha256-zZqhvfpkkbWLhPJIthDgxqvPUMpaXkyptuzY2fcecHU=";
32 };
33
34 cargoDeps = rustPlatform.importCargoLock {
35 lockFile = ./Cargo.lock;
36 outputHashes = {
37 "pyo3-file-0.8.1" = "sha256-EqeXykP7CF8SU5LgT9+y/FDy79E/DAJT2fc1OrmlOZE=";
38 };
39 };
40
41 postPatch = ''
42 ln -s ${./Cargo.lock} Cargo.lock
43 '';
44
45 buildInputs = [ libiconv ];
46
47 build-system = [
48 cargo
49 poetry-core
50 rustPlatform.cargoSetupHook
51 rustPlatform.maturinBuildHook
52 rustc
53 ];
54
55 dependencies = [ packaging ];
56
57 nativeCheckInputs = [ pytestCheckHook ];
58
59 pythonImportsCheck = [ "python_calamine" ];
60
61 meta = {
62 description = "Python binding for calamine";
63 homepage = "https://github.com/dimastbk/python-calamine";
64 changelog = "https://github.com/dimastbk/python-calamine/releases/tag/v${version}";
65 license = lib.licenses.mit;
66 maintainers = with lib.maintainers; [ fab ];
67 mainProgram = "python-calamine";
68 };
69}