packages/build-support/buildPythonPackage: fix for new drv-parts version
This commit is contained in:
parent
ed094531dc
commit
97ded90c9e
2 changed files with 64 additions and 55 deletions
|
@ -1,4 +1,4 @@
|
||||||
{ config, dependencySets, lib, ... }:
|
{ config, dependencySets, drv-parts, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (config) deps;
|
inherit (config) deps;
|
||||||
|
@ -19,7 +19,11 @@ let
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
pname = lib.mkIf hasPyproject (lib.mkDefault pyproject.tool.poetry.name);
|
imports = [
|
||||||
|
drv-parts.modules.drv-parts.mkDerivation
|
||||||
|
];
|
||||||
|
|
||||||
|
name = lib.mkIf hasPyproject (lib.mkDefault pyproject.tool.poetry.name);
|
||||||
version = lib.mkIf hasPyproject (lib.mkDefault pyproject.tool.poetry.version);
|
version = lib.mkIf hasPyproject (lib.mkDefault pyproject.tool.poetry.version);
|
||||||
|
|
||||||
deps = { pkgs, python3Packages, ... }: {
|
deps = { pkgs, python3Packages, ... }: {
|
||||||
|
@ -46,56 +50,59 @@ in
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = with deps; [
|
|
||||||
python
|
|
||||||
wrapPython
|
|
||||||
ensureNewerSourcesForZipFilesHook
|
|
||||||
pythonRemoveTestsDirHook
|
|
||||||
] ++ lib.optionals config.catchConflicts [
|
|
||||||
pythonCatchConflictsHook
|
|
||||||
] ++ lib.optionals config.removeBinByteCode [
|
|
||||||
pythonRemoveBinBytecodeHook
|
|
||||||
] ++ lib.optionals (lib.hasSuffix "zip" (config.src.name or "")) [
|
|
||||||
unzip
|
|
||||||
] ++ lib.optionals (config.format == "setuptools") [
|
|
||||||
setuptoolsBuildHook
|
|
||||||
] ++ lib.optionals (config.format == "flit") [
|
|
||||||
flitBuildHook
|
|
||||||
] ++ lib.optionals (config.format == "pyproject") [
|
|
||||||
pipBuildHook
|
|
||||||
] ++ lib.optionals (config.format == "wheel") [
|
|
||||||
wheelUnpackHook
|
|
||||||
] ++ lib.optionals (config.format == "egg") [
|
|
||||||
eggUnpackHook eggBuildHook eggInstallHook
|
|
||||||
] ++ lib.optionals (!(config.format == "other") || config.dontUsePipInstall) [
|
|
||||||
pipInstallHook
|
|
||||||
] ++ lib.optionals (python.stdenv.buildPlatform == python.stdenv.hostPlatform) [
|
|
||||||
# This is a test, however, it should be ran independent of the checkPhase and checkInputs
|
|
||||||
pythonImportsCheckHook
|
|
||||||
] ++ lib.optionals (python.pythonAtLeast "3.3") [
|
|
||||||
# Optionally enforce PEP420 for python3
|
|
||||||
pythonNamespacesHook
|
|
||||||
] ++ lib.optionals withDistOutput [
|
|
||||||
pythonOutputDistHook
|
|
||||||
];
|
|
||||||
|
|
||||||
propagatedBuildInputs = with deps; [
|
|
||||||
python
|
|
||||||
];
|
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
LANG = "${if deps.python.stdenv.isDarwin then "en_US" else "C"}.UTF-8";
|
LANG = "${if deps.python.stdenv.isDarwin then "en_US" else "C"}.UTF-8";
|
||||||
};
|
};
|
||||||
|
|
||||||
doCheck = false;
|
mkDerivation = {
|
||||||
doInstallCheck = lib.mkDefault true;
|
|
||||||
installCheckInputs = lib.optionals (config.format == "setuptools") [
|
|
||||||
deps.setuptoolsCheckHook
|
|
||||||
];
|
|
||||||
|
|
||||||
postFixup = lib.mkBefore (lib.optionalString (!config.dontWrapPythonPrograms) ''
|
nativeBuildInputs = with deps; [
|
||||||
wrapPythonPrograms
|
python
|
||||||
'');
|
wrapPython
|
||||||
|
ensureNewerSourcesForZipFilesHook
|
||||||
|
pythonRemoveTestsDirHook
|
||||||
|
] ++ lib.optionals config.catchConflicts [
|
||||||
|
pythonCatchConflictsHook
|
||||||
|
] ++ lib.optionals config.removeBinByteCode [
|
||||||
|
pythonRemoveBinBytecodeHook
|
||||||
|
] ++ lib.optionals (lib.hasSuffix "zip" (config.src.name or "")) [
|
||||||
|
unzip
|
||||||
|
] ++ lib.optionals (config.format == "setuptools") [
|
||||||
|
setuptoolsBuildHook
|
||||||
|
] ++ lib.optionals (config.format == "flit") [
|
||||||
|
flitBuildHook
|
||||||
|
] ++ lib.optionals (config.format == "pyproject") [
|
||||||
|
pipBuildHook
|
||||||
|
] ++ lib.optionals (config.format == "wheel") [
|
||||||
|
wheelUnpackHook
|
||||||
|
] ++ lib.optionals (config.format == "egg") [
|
||||||
|
eggUnpackHook eggBuildHook eggInstallHook
|
||||||
|
] ++ lib.optionals (!(config.format == "other") || config.dontUsePipInstall) [
|
||||||
|
pipInstallHook
|
||||||
|
] ++ lib.optionals (python.stdenv.buildPlatform == python.stdenv.hostPlatform) [
|
||||||
|
# This is a test, however, it should be ran independent of the checkPhase and checkInputs
|
||||||
|
pythonImportsCheckHook
|
||||||
|
] ++ lib.optionals (python.pythonAtLeast "3.3") [
|
||||||
|
# Optionally enforce PEP420 for python3
|
||||||
|
pythonNamespacesHook
|
||||||
|
] ++ lib.optionals withDistOutput [
|
||||||
|
pythonOutputDistHook
|
||||||
|
];
|
||||||
|
|
||||||
outputs = [ "out" ] ++ lib.optional withDistOutput "dist";
|
propagatedBuildInputs = with deps; [
|
||||||
|
python
|
||||||
|
];
|
||||||
|
|
||||||
|
doCheck = false;
|
||||||
|
doInstallCheck = lib.mkDefault true;
|
||||||
|
installCheckInputs = lib.optionals (config.format == "setuptools") [
|
||||||
|
deps.setuptoolsCheckHook
|
||||||
|
];
|
||||||
|
|
||||||
|
postFixup = lib.mkBefore (lib.optionalString (!config.dontWrapPythonPrograms) ''
|
||||||
|
wrapPythonPrograms
|
||||||
|
'');
|
||||||
|
|
||||||
|
outputs = [ "out" ] ++ lib.optional withDistOutput "dist";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,14 +25,16 @@
|
||||||
];
|
];
|
||||||
pyprojectToml = ./pyproject.toml;
|
pyprojectToml = ./pyproject.toml;
|
||||||
|
|
||||||
propagatedBuildInputs = deps;
|
mkDerivation = {
|
||||||
|
propagatedBuildInputs = deps;
|
||||||
|
|
||||||
src = with inputs.nix-filter.lib; filter {
|
src = with inputs.nix-filter.lib; filter {
|
||||||
root = ./.;
|
root = ./.;
|
||||||
include = [
|
include = [
|
||||||
"pyproject.toml"
|
"pyproject.toml"
|
||||||
(inDirectory "reflex_cache")
|
(inDirectory "reflex_cache")
|
||||||
];
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue