1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 pytestCheckHook,
7 pythonOlder,
8}:
9
10buildPythonPackage rec {
11 pname = "frozendict";
12 version = "2.4.6";
13 pyproject = true;
14
15 disabled = pythonOlder "3.6";
16
17 src = fetchFromGitHub {
18 owner = "Marco-Sulla";
19 repo = "python-frozendict";
20 tag = "v${version}";
21 hash = "sha256-cdKI0wIr0w6seV12cigqyJL6PSkLVzwVxASUB8n7lFY=";
22 };
23
24 # build C version if it exists
25 preBuild = ''
26 version_str=$(python -c 'import sys; print("_".join(map(str, sys.version_info[:2])))')
27 if test -f src/frozendict/c_src/$version_str/frozendictobject.c; then
28 export CIBUILDWHEEL=1
29 export FROZENDICT_PURE_PY=0
30 else
31 export CIBUILDWHEEL=0
32 export FROZENDICT_PURE_PY=1
33 fi
34 '';
35
36 nativeBuildInputs = [ setuptools ];
37
38 nativeCheckInputs = [ pytestCheckHook ];
39
40 pythonImportsCheck = [ "frozendict" ];
41
42 meta = with lib; {
43 description = "Module for immutable dictionary";
44 homepage = "https://github.com/Marco-Sulla/python-frozendict";
45 changelog = "https://github.com/Marco-Sulla/python-frozendict/releases/tag/v${version}";
46 license = licenses.lgpl3Only;
47 maintainers = with maintainers; [ pbsds ];
48 };
49}