summary refs log tree commit diff
path: root/pkgs/development/tools/build-managers/gup/build.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/build-managers/gup/build.nix')
-rw-r--r--pkgs/development/tools/build-managers/gup/build.nix30
1 files changed, 23 insertions, 7 deletions
diff --git a/pkgs/development/tools/build-managers/gup/build.nix b/pkgs/development/tools/build-managers/gup/build.nix
index a9af037bb81e..b2a60c309b32 100644
--- a/pkgs/development/tools/build-managers/gup/build.nix
+++ b/pkgs/development/tools/build-managers/gup/build.nix
@@ -1,14 +1,30 @@
-# NOTE: this file is copied from the upstream repository for this package.
-# Please submit any changes you make here to https://github.com/timbertson/gup/
+# NOTE: the `nixpkgs` version of this file is copied from the upstream repository
+# for this package. Please make any changes to https://github.com/timbertson/gup/
 
-{ stdenv, lib, python, which, pychecker ? null }:
-{ src, version, meta ? {} }:
+{ stdenv, lib, pythonPackages }:
+{ src, version, meta ? {}, passthru ? {}, forceTests ? false }:
+let
+  testInputs = [
+    pythonPackages.mocktest or null
+    pythonPackages.whichcraft
+    pythonPackages.nose
+    pythonPackages.nose_progressive
+  ];
+  pychecker = pythonPackages.pychecker or null;
+  usePychecker = forceTests || pychecker != null;
+  enableTests = forceTests || (lib.all (dep: dep != null) testInputs);
+in
 stdenv.mkDerivation {
-  inherit src meta;
+  inherit src meta passthru;
   name = "gup-${version}";
-  buildInputs = lib.remove null [ python which pychecker ];
-  SKIP_PYCHECKER = pychecker == null;
+  buildInputs = [ pythonPackages.python ]
+    ++ (lib.optionals enableTests testInputs)
+    ++ (lib.optional usePychecker pychecker)
+  ;
+  SKIP_PYCHECKER = !usePychecker;
   buildPhase = "make python";
+  inherit pychecker;
+  testPhase = if enableTests then "make test" else "true";
   installPhase = ''
     mkdir $out
     cp -r python/bin $out/bin