fix indentation in mk-python-derivation.nix

This commit is contained in:
DavHau 2020-06-27 14:26:03 +00:00
parent d651626eb9
commit d1c1a0c656

View File

@ -105,81 +105,81 @@ let
"disabled" "checkPhase" "checkInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts" "format" "disabled" "checkPhase" "checkInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts" "format"
]) // { ]) // {
name = namePrefix + name; name = namePrefix + name;
nativeBuildInputs = [ nativeBuildInputs = [
python python
wrapPython wrapPython
ensureNewerSourcesForZipFilesHook # move to wheel installer (pip) or builder (setuptools, flit, ...)? ensureNewerSourcesForZipFilesHook # move to wheel installer (pip) or builder (setuptools, flit, ...)?
pythonRecompileBytecodeHook # Remove when solved https://github.com/NixOS/nixpkgs/issues/81441 pythonRecompileBytecodeHook # Remove when solved https://github.com/NixOS/nixpkgs/issues/81441
pythonRemoveTestsDirHook pythonRemoveTestsDirHook
] ++ lib.optionals catchConflicts [ ] ++ lib.optionals catchConflicts [
setuptools pythonCatchConflictsHook setuptools pythonCatchConflictsHook
] ++ lib.optionals removeBinBytecode [ ] ++ lib.optionals removeBinBytecode [
pythonRemoveBinBytecodeHook pythonRemoveBinBytecodeHook
] ++ lib.optionals (lib.hasSuffix "zip" (attrs.src.name or "")) [ ] ++ lib.optionals (lib.hasSuffix "zip" (attrs.src.name or "")) [
unzip unzip
] ++ lib.optionals (format == "setuptools") [ ] ++ lib.optionals (format == "setuptools") [
setuptoolsBuildHook setuptoolsBuildHook
] ++ lib.optionals (format == "flit") [ ] ++ lib.optionals (format == "flit") [
flitBuildHook flitBuildHook
] ++ lib.optionals (format == "pyproject") [ ] ++ lib.optionals (format == "pyproject") [
pipBuildHook pipBuildHook
] ++ lib.optionals (format == "wheel") [ ] ++ lib.optionals (format == "wheel") [
wheelUnpackHook wheelUnpackHook
] ++ lib.optionals (format == "egg") [ ] ++ lib.optionals (format == "egg") [
eggUnpackHook eggBuildHook eggInstallHook eggUnpackHook eggBuildHook eggInstallHook
] ++ lib.optionals (!(format == "other") || dontUsePipInstall) [ ] ++ lib.optionals (!(format == "other") || dontUsePipInstall) [
pipInstallHook pipInstallHook
] ++ lib.optionals (stdenv.buildPlatform == stdenv.hostPlatform) [ ] ++ lib.optionals (stdenv.buildPlatform == stdenv.hostPlatform) [
# This is a test, however, it should be ran independent of the checkPhase and checkInputs # This is a test, however, it should be ran independent of the checkPhase and checkInputs
pythonImportsCheckHook pythonImportsCheckHook
] ++ lib.optionals (python.pythonAtLeast "3.3") [ ] ++ lib.optionals (python.pythonAtLeast "3.3") [
# Optionally enforce PEP420 for python3 # Optionally enforce PEP420 for python3
pythonNamespacesHook pythonNamespacesHook
] ++ nativeBuildInputs; ] ++ nativeBuildInputs;
buildInputs = buildInputs ++ pythonPath; buildInputs = buildInputs ++ pythonPath;
propagatedBuildInputs = propagatedBuildInputs ++ [ python ]; propagatedBuildInputs = propagatedBuildInputs ++ [ python ];
inherit strictDeps; inherit strictDeps;
LANG = "${if python.stdenv.isDarwin then "en_US" else "C"}.UTF-8"; LANG = "${if python.stdenv.isDarwin then "en_US" else "C"}.UTF-8";
# Python packages don't have a checkPhase, only an installCheckPhase # Python packages don't have a checkPhase, only an installCheckPhase
doCheck = false; doCheck = false;
doInstallCheck = attrs.doCheck or true; doInstallCheck = attrs.doCheck or true;
installCheckInputs = [ installCheckInputs = [
] ++ lib.optionals (format == "setuptools") [ ] ++ lib.optionals (format == "setuptools") [
# Longer-term we should get rid of this and require # Longer-term we should get rid of this and require
# users of this function to set the `installCheckPhase` or # users of this function to set the `installCheckPhase` or
# pass in a hook that sets it. # pass in a hook that sets it.
setuptoolsCheckHook setuptoolsCheckHook
] ++ checkInputs; ] ++ checkInputs;
postFixup = lib.optionalString (!dontWrapPythonPrograms) '' postFixup = lib.optionalString (!dontWrapPythonPrograms) ''
wrapPythonPrograms wrapPythonPrograms
'' + attrs.postFixup or ''''; '' + attrs.postFixup or '''';
# Python packages built through cross-compilation are always for the host platform. # Python packages built through cross-compilation are always for the host platform.
disallowedReferences = lib.optionals (python.stdenv.hostPlatform != python.stdenv.buildPlatform) [ python.pythonForBuild ]; disallowedReferences = lib.optionals (python.stdenv.hostPlatform != python.stdenv.buildPlatform) [ python.pythonForBuild ];
# For now, revert recompilation of bytecode. # For now, revert recompilation of bytecode.
dontUsePythonRecompileBytecode = true; dontUsePythonRecompileBytecode = true;
meta = { meta = {
# default to python's platforms # default to python's platforms
platforms = python.meta.platforms; platforms = python.meta.platforms;
isBuildPythonPackage = python.meta.platforms; isBuildPythonPackage = python.meta.platforms;
} // meta; } // meta;
} // lib.optionalAttrs (attrs?checkPhase) { } // lib.optionalAttrs (attrs?checkPhase) {
# If given use the specified checkPhase, otherwise use the setup hook. # If given use the specified checkPhase, otherwise use the setup hook.
# Longer-term we should get rid of `checkPhase` and use `installCheckPhase`. # Longer-term we should get rid of `checkPhase` and use `installCheckPhase`.
installCheckPhase = attrs.checkPhase; installCheckPhase = attrs.checkPhase;
})); }));
passthru.updateScript = let passthru.updateScript = let
filename = builtins.head (lib.splitString ":" self.meta.position); filename = builtins.head (lib.splitString ":" self.meta.position);
in attrs.passthru.updateScript or [ update-python-libraries filename ]; in attrs.passthru.updateScript or [ update-python-libraries filename ];
in lib.extendDerivation true passthru self in lib.extendDerivation true passthru self