Merge pull request #329638 from shivaraj-bh/commitizen-library

python3Packages.commitizen: Add library along with binary
This commit is contained in:
Sandro 2024-07-29 13:52:09 +02:00 committed by GitHub
commit f82b7afd37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 34 additions and 11 deletions

View File

@ -1,20 +1,39 @@
{ lib
, commitizen
, fetchFromGitHub
, buildPythonPackage
, git
, python3
, 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
}:
python3.pkgs.buildPythonApplication rec {
buildPythonPackage rec {
pname = "commitizen";
version = "3.28.0";
format = "pyproject";
disabled = python3.pythonOlder "3.8";
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "commitizen-tools";
@ -28,12 +47,12 @@ python3.pkgs.buildPythonApplication rec {
"decli"
];
nativeBuildInputs = with python3.pkgs; [
nativeBuildInputs = [
poetry-core
installShellFiles
];
propagatedBuildInputs = with python3.pkgs; [
propagatedBuildInputs = [
argcomplete
charset-normalizer
colorama
@ -47,7 +66,7 @@ python3.pkgs.buildPythonApplication rec {
tomlkit
];
nativeCheckInputs = with python3.pkgs; [
nativeCheckInputs = [
argcomplete
deprecated
git
@ -60,6 +79,8 @@ python3.pkgs.buildPythonApplication rec {
doCheck = true;
pythonImportsCheck = [ "commitizen" ];
# The tests require a functional git installation
# which requires a valid HOME directory.
preCheck = ''
@ -85,14 +106,14 @@ python3.pkgs.buildPythonApplication rec {
postInstall =
let
argcomplete = lib.getExe' python3.pkgs.argcomplete "register-python-argcomplete";
register-python-argcomplete = lib.getExe' 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)
--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 = {

View File

@ -4544,7 +4544,7 @@ with pkgs;
comma = callPackage ../tools/package-management/comma { };
commitizen = callPackage ../applications/version-management/commitizen { };
commitizen = with python3Packages; toPythonApplication commitizen;
common-licenses = callPackage ../data/misc/common-licenses { };

View File

@ -2053,6 +2053,8 @@ self: super: with self; {
command-runner = callPackage ../development/python-modules/command-runner { };
commitizen = callPackage ../development/python-modules/commitizen { };
connect-box = callPackage ../development/python-modules/connect-box { };
connection-pool = callPackage ../development/python-modules/connection-pool { };