1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
{
lib,
commitizen,
fetchFromGitHub,
buildPythonPackage,
gitMinimal,
pythonOlder,
stdenv,
installShellFiles,
poetry-core,
nix-update-script,
testers,
argcomplete,
charset-normalizer,
colorama,
decli,
importlib-metadata,
jinja2,
packaging,
pyyaml,
questionary,
termcolor,
tomlkit,
py,
pytest-freezer,
pytest-mock,
pytest-regressions,
pytest7CheckHook,
deprecated,
}:
buildPythonPackage rec {
pname = "commitizen";
version = "4.4.1";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "commitizen-tools";
repo = "commitizen";
tag = "v${version}";
hash = "sha256-nKX5mMqcUcQfL0r0uVj2tFTW3qaSCx42roSV6qaf0yU=";
};
pythonRelaxDeps = [
"argcomplete"
"decli"
];
build-system = [ poetry-core ];
nativeBuildInputs = [ installShellFiles ];
dependencies = [
argcomplete
charset-normalizer
colorama
decli
importlib-metadata
jinja2
packaging
pyyaml
questionary
termcolor
tomlkit
];
nativeCheckInputs = [
argcomplete
deprecated
gitMinimal
py
pytest-freezer
pytest-mock
pytest-regressions
pytest7CheckHook
];
pythonImportsCheck = [ "commitizen" ];
# The tests require a functional git installation
# which requires a valid HOME directory.
preCheck = ''
export HOME="$(mktemp -d)"
git config --global user.name "Nix Builder"
git config --global user.email "nix-builder@nixos.org"
git init .
'';
# NB: These tests require complex GnuPG setup
disabledTests = [
"test_bump_minor_increment_signed"
"test_bump_minor_increment_signed_config_file"
"test_bump_on_git_with_hooks_no_verify_enabled"
"test_bump_on_git_with_hooks_no_verify_disabled"
"test_bump_pre_commit_changelog"
"test_bump_pre_commit_changelog_fails_always"
"test_get_commits_with_signature"
# fatal: not a git repository (or any of the parent directories): .git
"test_commitizen_debug_excepthook"
];
postInstall =
let
register-python-argcomplete = lib.getExe' argcomplete "register-python-argcomplete";
in
lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd cz \
--bash <(${register-python-argcomplete} --shell bash $out/bin/cz) \
--zsh <(${register-python-argcomplete} --shell zsh $out/bin/cz) \
--fish <(${register-python-argcomplete} --shell fish $out/bin/cz)
'';
passthru = {
updateScript = nix-update-script { };
tests.version = testers.testVersion {
package = commitizen;
command = "cz version";
};
};
meta = with lib; {
description = "Tool to create committing rules for projects, auto bump versions, and generate changelogs";
homepage = "https://github.com/commitizen-tools/commitizen";
changelog = "https://github.com/commitizen-tools/commitizen/blob/v${version}/CHANGELOG.md";
license = licenses.mit;
mainProgram = "cz";
maintainers = with maintainers; [
lovesegfault
anthonyroussel
];
};
}
|