1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 setuptools,
7 strct,
8 pytestCheckHook,
9 pyyaml,
10}:
11
12buildPythonPackage rec {
13 pname = "birch";
14 version = "0.0.35";
15 pyproject = true;
16
17 src = fetchFromGitHub {
18 owner = "shaypal5";
19 repo = "birch";
20 rev = "v${version}";
21 hash = "sha256-KdQZzQJvJ+logpcLQfaqqEEZJ/9VmNTQX/a4v0oBC98=";
22 };
23
24 patches = [
25 # https://github.com/shaypal5/birch/pull/4
26 (fetchpatch {
27 name = "fix-versioneer-on-python312.patch";
28 url = "https://github.com/shaypal5/birch/commit/84d597b2251ebb76fb15fb70fc86c83baa19dc0b.patch";
29 hash = "sha256-xXADCSIhq1ARny2twzrhR1J8LkMFWFl6tmGxrM8RvkU=";
30 })
31 ];
32
33 postPatch = ''
34 substituteInPlace pytest.ini \
35 --replace-fail \
36 "--cov" \
37 "#--cov"
38
39 # configure correct version, which fails due to missing .git
40 substituteInPlace versioneer.py birch/_version.py \
41 --replace-fail '"0+unknown"' '"${version}"'
42 '';
43
44 nativeBuildInputs = [ setuptools ];
45
46 dependencies = [ strct ];
47
48 pythonImportsCheck = [
49 "birch"
50 "birch.casters"
51 "birch.exceptions"
52 "birch.paths"
53 ];
54
55 nativeCheckInputs = [
56 pytestCheckHook
57 pyyaml
58 ];
59
60 preCheck = ''
61 export HOME="$(mktemp -d)"
62 '';
63
64 meta = with lib; {
65 description = "Simple hierarchical configuration for Python packages";
66 homepage = "https://github.com/shaypal5/birch";
67 license = licenses.mit;
68 maintainers = with maintainers; [ pbsds ];
69 };
70}