Skip to content

Commit

Permalink
buildPythonPackage: add prefix to pname
Browse files Browse the repository at this point in the history
The `pname` passed to `stdenv.mkDerivation` consists of the name prefix
as well as the `pname` passed to `stdenv.mkDerivation`.

This is needed in case we want to test for valid `pname` in
`stdenv.mkDerivation`.
NixOS#68620 (comment)
  • Loading branch information
FRidh committed Mar 29, 2020
1 parent ce9bec8 commit 3b2d55b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions pkgs/development/interpreters/python/mk-python-derivation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@
, eggInstallHook
}:

{ name ? "${attrs.pname}-${attrs.version}"

{
# Build-time dependencies for the package
, nativeBuildInputs ? []
nativeBuildInputs ? []

# Run-time dependencies for the package
, buildInputs ? []
Expand Down Expand Up @@ -94,17 +93,17 @@

# Keep extra attributes from `attrs`, e.g., `patchPhase', etc.
if disabled
then throw "${name} not supported for interpreter ${python.executable}"
then throw "${attrs.pname} of version ${attrs.version} not supported for interpreter ${python.executable}"
else

let
inherit (python) stdenv;

self = toPythonModule (stdenv.mkDerivation ((builtins.removeAttrs attrs [
"disabled" "checkPhase" "checkInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts" "format"
"pname" "disabled" "checkPhase" "checkInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts" "format"
]) // {

name = namePrefix + name;
pname = namePrefix + attrs.pname;

nativeBuildInputs = [
python
Expand Down
2 changes: 1 addition & 1 deletion pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ let
# Remove Python prefix from name so we have a "normal" name.
# While the prefix shows up in the store path, it won't be
# used by `nix-env`.
name = removePythonPrefix oldAttrs.name;
pname = removePythonPrefix oldAttrs.pname;
pythonModule = false;
};
});
Expand Down

0 comments on commit 3b2d55b

Please sign in to comment.