nixpkgs/pkgs/development/python-modules/commitizen/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

136 lines
3.0 KiB
Nix
Raw Permalink Normal View History

{
lib,
commitizen,
fetchFromGitHub,
buildPythonPackage,
git,
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,
2022-01-03 19:48:50 +00:00
}:
buildPythonPackage rec {
2022-01-03 19:48:50 +00:00
pname = "commitizen";
version = "3.30.0";
2024-08-12 20:40:44 +00:00
pyproject = true;
2022-01-03 19:48:50 +00:00
disabled = pythonOlder "3.8";
2022-01-03 19:48:50 +00:00
src = fetchFromGitHub {
owner = "commitizen-tools";
2024-08-12 20:40:44 +00:00
repo = "commitizen";
rev = "refs/tags/v${version}";
hash = "sha256-8ULIoFKrDAGHwz0EZzYJtl/4h6UVUECLUDbvTJbdD60=";
2022-01-03 19:48:50 +00:00
};
pythonRelaxDeps = [
"argcomplete"
"decli"
];
2022-01-03 19:48:50 +00:00
2024-08-12 20:40:44 +00:00
build-system = [ poetry-core ];
nativeBuildInputs = [ installShellFiles ];
2024-08-12 20:40:44 +00:00
dependencies = [
argcomplete
charset-normalizer
2022-01-03 19:48:50 +00:00
colorama
decli
importlib-metadata
2022-01-03 19:48:50 +00:00
jinja2
2022-01-26 07:25:23 +00:00
packaging
pyyaml
questionary
termcolor
tomlkit
2022-01-03 19:48:50 +00:00
];
nativeCheckInputs = [
argcomplete
deprecated
git
py
2023-01-14 21:20:04 +00:00
pytest-freezer
2022-01-26 07:25:38 +00:00
pytest-mock
pytest-regressions
pytest7CheckHook
2022-01-26 07:25:38 +00:00
];
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
2022-01-26 07:25:38 +00:00
disabledTests = [
"test_bump_minor_increment_signed"
"test_bump_minor_increment_signed_config_file"
2022-01-26 07:25:38 +00:00
"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"
2022-01-26 07:25:38 +00:00
"test_get_commits_with_signature"
# fatal: not a git repository (or any of the parent directories): .git
"test_commitizen_debug_excepthook"
2022-01-26 07:25:38 +00:00
];
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)
'';
2023-01-14 21:20:04 +00:00
passthru = {
2023-09-28 06:32:43 +00:00
updateScript = nix-update-script { };
2023-01-14 21:20:04 +00:00
tests.version = testers.testVersion {
package = commitizen;
command = "cz version";
};
};
2022-10-28 20:20:06 +00:00
2022-01-03 19:48:50 +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-10-28 20:18:37 +00:00
changelog = "https://github.com/commitizen-tools/commitizen/blob/v${version}/CHANGELOG.md";
2022-01-03 19:48:50 +00:00
license = licenses.mit;
2023-09-28 06:25:14 +00:00
mainProgram = "cz";
maintainers = with maintainers; [
lovesegfault
anthonyroussel
];
2022-01-03 19:48:50 +00:00
};
}