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