Skip to content

Commit

Permalink
stdenv: steal checkInputs from buildPythonPackage
Browse files Browse the repository at this point in the history
Note that a bunch of non-python packages use this attribute already.
Some of those are clearly unaware of the fact that this attribute does
not exists in stdenv because they define it but don't to add it to
their `bulidInputs` :)

Also note that I use `buildInputs` here and only handle regular
builds because python and haskell builders do it this way and I'm not
sure how to properly handle the cross-compilation case.
  • Loading branch information
oxij committed Apr 26, 2018
1 parent 9345fc5 commit 87651b3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
14 changes: 14 additions & 0 deletions doc/stdenv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,13 @@ but only if the <varname>doCheck</varname> variable is enabled.</para>
</para></listitem>
</varlistentry>

<varlistentry>
<term><varname>checkInputs</varname></term>
<listitem><para>
A list of dependencies used by the phase. This gets included in <varname>buildInputs</varname> when <varname>doCheck</varname> is set.
</para></listitem>
</varlistentry>

<varlistentry>
<term><varname>makeFlags</varname> /
<varname>makeFlagsArray</varname> /
Expand Down Expand Up @@ -1291,6 +1298,13 @@ installcheck</command>.</para>
</para></listitem>
</varlistentry>

<varlistentry>
<term><varname>installCheckInputs</varname></term>
<listitem><para>
A list of dependencies used by the phase. This gets included in <varname>buildInputs</varname> when <varname>doInstallCheck</varname> is set.
</para></listitem>
</varlistentry>

<varlistentry>
<term><varname>preInstallCheck</varname></term>
<listitem><para>Hook executed at the start of the installCheck
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attrs [

buildInputs = [ wrapPython ]
++ lib.optional (lib.hasSuffix "zip" (attrs.src.name or "")) unzip
++ lib.optionals doCheck checkInputs
++ lib.optional catchConflicts setuptools # If we no longer propagate setuptools
++ buildInputs
++ pythonPath;
Expand All @@ -86,6 +85,7 @@ toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attrs [
# Python packages don't have a checkPhase, only an installCheckPhase
doCheck = false;
doInstallCheck = doCheck;
installCheckInputs = checkInputs;

postFixup = lib.optionalString (!dontWrapPythonPrograms) ''
wrapPythonPrograms
Expand Down
8 changes: 7 additions & 1 deletion pkgs/stdenv/generic/make-derivation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ rec {
, depsTargetTarget ? [] # 1 -> 1
, depsTargetTargetPropagated ? [] # 1 -> 1

, checkInputs ? []
, installCheckInputs ? []

# Configure Phase
, configureFlags ? []
, # Target is not included by default because most programs don't care.
Expand Down Expand Up @@ -101,7 +104,9 @@ rec {
]
[
(map (drv: drv.__spliced.hostHost or drv) depsHostHost)
(map (drv: drv.crossDrv or drv) buildInputs)
(map (drv: drv.crossDrv or drv) (buildInputs
++ lib.optionals doCheck' checkInputs
++ lib.optionals doInstallCheck' installCheckInputs))
]
[
(map (drv: drv.__spliced.targetTarget or drv) depsTargetTarget)
Expand Down Expand Up @@ -155,6 +160,7 @@ rec {
(removeAttrs attrs
["meta" "passthru" "crossAttrs" "pos"
"doCheck" "doInstallCheck"
"checkInputs" "installCheckInputs"
"__impureHostDeps" "__propagatedImpureHostDeps"
"sandboxProfile" "propagatedSandboxProfile"])
// {
Expand Down

0 comments on commit 87651b3

Please sign in to comment.