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