about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/package-management/pdm/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/package-management/pdm/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/package-management/pdm/default.nix27
1 files changed, 26 insertions, 1 deletions
diff --git a/nixpkgs/pkgs/tools/package-management/pdm/default.nix b/nixpkgs/pkgs/tools/package-management/pdm/default.nix
index d94aaeae69d9..957b11b084fa 100644
--- a/nixpkgs/pkgs/tools/package-management/pdm/default.nix
+++ b/nixpkgs/pkgs/tools/package-management/pdm/default.nix
@@ -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; {