2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
2023-01-20 10:41:00 +00:00
|
|
|
, commitizen
|
2022-03-05 16:20:37 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, git
|
2023-07-15 17:15:38 +00:00
|
|
|
, python3
|
2023-10-09 19:29:22 +00:00
|
|
|
, stdenv
|
|
|
|
, installShellFiles
|
|
|
|
, nix-update-script
|
2023-01-20 10:41:00 +00:00
|
|
|
, testers
|
2022-01-26 04:04:25 +00:00
|
|
|
}:
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
python3.pkgs.buildPythonApplication rec {
|
2022-01-26 04:04:25 +00:00
|
|
|
pname = "commitizen";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "3.27.0";
|
2023-07-15 17:15:38 +00:00
|
|
|
format = "pyproject";
|
2022-01-26 04:04:25 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
disabled = python3.pythonOlder "3.8";
|
|
|
|
|
2022-01-26 04:04:25 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "commitizen-tools";
|
|
|
|
repo = pname;
|
2023-07-15 17:15:38 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-06-05 15:53:02 +00:00
|
|
|
hash = "sha256-Bfz9MBpFsbAcsyQ7CYyObE14q7UE9ZyeY1GVFb9maKk=";
|
2022-01-26 04:04:25 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
pythonRelaxDeps = [
|
|
|
|
"decli"
|
|
|
|
];
|
2022-01-26 04:04:25 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
nativeBuildInputs = with python3.pkgs; [
|
|
|
|
poetry-core
|
|
|
|
pythonRelaxDepsHook
|
2023-10-09 19:29:22 +00:00
|
|
|
installShellFiles
|
2023-07-15 17:15:38 +00:00
|
|
|
];
|
2023-01-20 10:41:00 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
propagatedBuildInputs = with python3.pkgs; [
|
|
|
|
argcomplete
|
2023-03-15 16:39:30 +00:00
|
|
|
charset-normalizer
|
2022-01-26 04:04:25 +00:00
|
|
|
colorama
|
|
|
|
decli
|
2023-07-15 17:15:38 +00:00
|
|
|
importlib-metadata
|
2022-01-26 04:04:25 +00:00
|
|
|
jinja2
|
2022-01-27 00:19:43 +00:00
|
|
|
packaging
|
2023-07-15 17:15:38 +00:00
|
|
|
pyyaml
|
|
|
|
questionary
|
|
|
|
termcolor
|
|
|
|
tomlkit
|
2022-01-27 00:19:43 +00:00
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
nativeCheckInputs = with python3.pkgs; [
|
|
|
|
argcomplete
|
|
|
|
deprecated
|
|
|
|
git
|
2023-01-20 10:41:00 +00:00
|
|
|
py
|
|
|
|
pytest-freezer
|
2022-01-27 00:19:43 +00:00
|
|
|
pytest-mock
|
|
|
|
pytest-regressions
|
2024-04-21 15:54:59 +00:00
|
|
|
pytest7CheckHook
|
2022-01-27 00:19:43 +00:00
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
# The tests require a functional git installation
|
2022-10-06 18:32:54 +00:00
|
|
|
# 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
|
2022-01-27 00:19:43 +00:00
|
|
|
disabledTests = [
|
2022-10-06 18:32:54 +00:00
|
|
|
"test_bump_minor_increment_signed"
|
|
|
|
"test_bump_minor_increment_signed_config_file"
|
2022-01-27 00:19:43 +00:00
|
|
|
"test_bump_on_git_with_hooks_no_verify_enabled"
|
2022-10-06 18:32:54 +00:00
|
|
|
"test_bump_on_git_with_hooks_no_verify_disabled"
|
2022-08-12 12:06:08 +00:00
|
|
|
"test_bump_pre_commit_changelog"
|
|
|
|
"test_bump_pre_commit_changelog_fails_always"
|
2022-01-27 00:19:43 +00:00
|
|
|
"test_get_commits_with_signature"
|
2023-01-20 10:41:00 +00:00
|
|
|
# fatal: not a git repository (or any of the parent directories): .git
|
|
|
|
"test_commitizen_debug_excepthook"
|
2022-01-26 04:04:25 +00:00
|
|
|
];
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
postInstall =
|
|
|
|
let
|
|
|
|
argcomplete = lib.getExe' python3.pkgs.argcomplete "register-python-argcomplete";
|
|
|
|
in
|
|
|
|
lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform)
|
|
|
|
''
|
|
|
|
installShellCompletion --cmd cz \
|
|
|
|
--bash <(${argcomplete} --shell bash $out/bin/cz) \
|
|
|
|
--zsh <(${argcomplete} --shell zsh $out/bin/cz) \
|
|
|
|
--fish <(${argcomplete} --shell fish $out/bin/cz)
|
|
|
|
'';
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
passthru = {
|
2023-10-09 19:29:22 +00:00
|
|
|
updateScript = nix-update-script { };
|
2023-01-20 10:41:00 +00:00
|
|
|
tests.version = testers.testVersion {
|
|
|
|
package = commitizen;
|
|
|
|
command = "cz version";
|
|
|
|
};
|
|
|
|
};
|
2022-11-02 22:02:43 +00:00
|
|
|
|
2022-01-26 04:04:25 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Tool to create committing rules for projects, auto bump versions, and generate changelogs";
|
|
|
|
homepage = "https://github.com/commitizen-tools/commitizen";
|
2022-11-02 22:02:43 +00:00
|
|
|
changelog = "https://github.com/commitizen-tools/commitizen/blob/v${version}/CHANGELOG.md";
|
2022-01-26 04:04:25 +00:00
|
|
|
license = licenses.mit;
|
2023-10-09 19:29:22 +00:00
|
|
|
mainProgram = "cz";
|
2022-10-06 18:32:54 +00:00
|
|
|
maintainers = with maintainers; [ lovesegfault anthonyroussel ];
|
2022-01-26 04:04:25 +00:00
|
|
|
};
|
|
|
|
}
|