pdm: install shell completion

This commit is contained in:
Maxime Brunet 2024-02-12 22:09:32 -08:00
parent cf59adeb8c
commit deed69c590
No known key found for this signature in database
GPG Key ID: 437962FF87ECFE2B

View File

@ -6,6 +6,9 @@
, fetchPypi
, nix-update-script
, runtimeShell
, installShellFiles
, testers
, pdm
}:
let
python = python3.override {
@ -44,6 +47,7 @@ buildPythonApplication rec {
nativeBuildInputs = [
pdm-backend
installShellFiles
];
propagatedBuildInputs = [
@ -76,6 +80,23 @@ buildPythonApplication rec {
truststore
];
makeWrapperArgs = [
"--set PDM_CHECK_UPDATE 0"
];
preInstall = ''
# Silence network warning during pypaInstallPhase
# by disabling latest version check
export PDM_CHECK_UPDATE=0
'';
postInstall = ''
installShellCompletion --cmd pdm \
--bash <($out/bin/pdm completion bash) \
--fish <($out/bin/pdm completion fish) \
--zsh <($out/bin/pdm completion zsh)
'';
nativeCheckInputs = [
pytestCheckHook
pytest-mock
@ -91,7 +112,7 @@ buildPythonApplication rec {
preCheck = ''
export HOME=$TMPDIR
substituteInPlace tests/cli/test_run.py \
--replace "/bin/bash" "${runtimeShell}"
--replace-warn "/bin/bash" "${runtimeShell}"
'';
disabledTests = [
@ -104,6 +125,10 @@ buildPythonApplication rec {
__darwinAllowLocalNetworking = true;
passthru.tests.version = testers.testVersion {
package = pdm;
};
passthru.updateScript = nix-update-script { };
meta = with lib; {