1{
2 lib,
3 poetry-core,
4 buildPythonPackage,
5 fetchFromGitHub,
6 pythonOlder,
7 importlib-metadata,
8 packaging,
9 pytestCheckHook,
10 git,
11}:
12
13buildPythonPackage rec {
14 pname = "dunamai";
15 version = "1.21.1";
16 pyproject = true;
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "mtkennerly";
22 repo = "dunamai";
23 rev = "refs/tags/v${version}";
24 hash = "sha256-dsL1MhlL1Yjj06D0z2FzZ53Frfp4U+5dXA9vPjU+pvY=";
25 };
26
27 nativeBuildInputs = [ poetry-core ];
28
29 propagatedBuildInputs = [ packaging ] ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
30
31 # needs to be able to run dunami from PATH
32 preCheck = ''
33 export PATH=$PATH:$out/bin
34 export HOME=$(mktemp -d)
35
36 git config --global user.email "nobody@example.com"
37 git config --global user.name "Nobody"
38 '';
39
40 nativeCheckInputs = [
41 git
42 pytestCheckHook
43 ];
44
45 disabledTests = [
46 # clones from github.com
47 "test__version__from_git__shallow"
48 ];
49
50 pythonImportsCheck = [ "dunamai" ];
51
52 meta = with lib; {
53 description = "Dynamic version generation";
54 mainProgram = "dunamai";
55 homepage = "https://github.com/mtkennerly/dunamai";
56 changelog = "https://github.com/mtkennerly/dunamai/blob/v${version}/CHANGELOG.md";
57 license = licenses.mit;
58 maintainers = with maintainers; [ jmgilman ];
59 };
60}