buildPython*: support fixed-point arguments (#271387)
This commit is contained in:
@@ -99,7 +99,12 @@ let
|
||||
"wheel"
|
||||
];
|
||||
|
||||
cleanAttrs = flip removeAttrs [
|
||||
in
|
||||
|
||||
lib.extendMkDerivation {
|
||||
constructDrv = stdenv.mkDerivation;
|
||||
|
||||
excludeDrvArgNames = [
|
||||
"disabled"
|
||||
"checkPhase"
|
||||
"checkInputs"
|
||||
@@ -114,93 +119,89 @@ let
|
||||
"build-system"
|
||||
];
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
# Build-time dependencies for the package
|
||||
nativeBuildInputs ? [ ],
|
||||
|
||||
# Run-time dependencies for the package
|
||||
buildInputs ? [ ],
|
||||
|
||||
# Dependencies needed for running the checkPhase.
|
||||
# These are added to buildInputs when doCheck = true.
|
||||
checkInputs ? [ ],
|
||||
nativeCheckInputs ? [ ],
|
||||
|
||||
# propagate build dependencies so in case we have A -> B -> C,
|
||||
# C can import package A propagated by B
|
||||
propagatedBuildInputs ? [ ],
|
||||
|
||||
# Python module dependencies.
|
||||
# These are named after PEP-621.
|
||||
dependencies ? [ ],
|
||||
optional-dependencies ? { },
|
||||
|
||||
# Python PEP-517 build systems.
|
||||
build-system ? [ ],
|
||||
|
||||
# DEPRECATED: use propagatedBuildInputs
|
||||
pythonPath ? [ ],
|
||||
|
||||
# Enabled to detect some (native)BuildInputs mistakes
|
||||
strictDeps ? true,
|
||||
|
||||
outputs ? [ "out" ],
|
||||
|
||||
# used to disable derivation, useful for specific python versions
|
||||
disabled ? false,
|
||||
|
||||
# Raise an error if two packages are installed with the same name
|
||||
# TODO: For cross we probably need a different PYTHONPATH, or not
|
||||
# add the runtime deps until after buildPhase.
|
||||
catchConflicts ? (python.stdenv.hostPlatform == python.stdenv.buildPlatform),
|
||||
|
||||
# Additional arguments to pass to the makeWrapper function, which wraps
|
||||
# generated binaries.
|
||||
makeWrapperArgs ? [ ],
|
||||
|
||||
# Skip wrapping of python programs altogether
|
||||
dontWrapPythonPrograms ? false,
|
||||
|
||||
# Don't use Pip to install a wheel
|
||||
# Note this is actually a variable for the pipInstallPhase in pip's setupHook.
|
||||
# It's included here to prevent an infinite recursion.
|
||||
dontUsePipInstall ? false,
|
||||
|
||||
# Skip setting the PYTHONNOUSERSITE environment variable in wrapped programs
|
||||
permitUserSite ? false,
|
||||
|
||||
# Remove bytecode from bin folder.
|
||||
# When a Python script has the extension `.py`, bytecode is generated
|
||||
# Typically, executables in bin have no extension, so no bytecode is generated.
|
||||
# However, some packages do provide executables with extensions, and thus bytecode is generated.
|
||||
removeBinBytecode ? true,
|
||||
|
||||
# pyproject = true <-> format = "pyproject"
|
||||
# pyproject = false <-> format = "other"
|
||||
# https://github.com/NixOS/nixpkgs/issues/253154
|
||||
pyproject ? null,
|
||||
|
||||
# Several package formats are supported.
|
||||
# "setuptools" : Install a common setuptools/distutils based package. This builds a wheel.
|
||||
# "wheel" : Install from a pre-compiled wheel.
|
||||
# "pyproject": Install a package using a ``pyproject.toml`` file (PEP517). This builds a wheel.
|
||||
# "egg": Install a package from an egg.
|
||||
# "other" : Provide your own buildPhase and installPhase.
|
||||
format ? null,
|
||||
|
||||
meta ? { },
|
||||
|
||||
doCheck ? true,
|
||||
|
||||
...
|
||||
}@attrs:
|
||||
|
||||
let
|
||||
# Keep extra attributes from `attrs`, e.g., `patchPhase', etc.
|
||||
self = stdenv.mkDerivation (
|
||||
extendDrvArgs =
|
||||
finalAttrs:
|
||||
{
|
||||
# Build-time dependencies for the package
|
||||
nativeBuildInputs ? [ ],
|
||||
|
||||
# Run-time dependencies for the package
|
||||
buildInputs ? [ ],
|
||||
|
||||
# Dependencies needed for running the checkPhase.
|
||||
# These are added to buildInputs when doCheck = true.
|
||||
checkInputs ? [ ],
|
||||
nativeCheckInputs ? [ ],
|
||||
|
||||
# propagate build dependencies so in case we have A -> B -> C,
|
||||
# C can import package A propagated by B
|
||||
propagatedBuildInputs ? [ ],
|
||||
|
||||
# Python module dependencies.
|
||||
# These are named after PEP-621.
|
||||
dependencies ? [ ],
|
||||
optional-dependencies ? { },
|
||||
|
||||
# Python PEP-517 build systems.
|
||||
build-system ? [ ],
|
||||
|
||||
# DEPRECATED: use propagatedBuildInputs
|
||||
pythonPath ? [ ],
|
||||
|
||||
# Enabled to detect some (native)BuildInputs mistakes
|
||||
strictDeps ? true,
|
||||
|
||||
outputs ? [ "out" ],
|
||||
|
||||
# used to disable derivation, useful for specific python versions
|
||||
disabled ? false,
|
||||
|
||||
# Raise an error if two packages are installed with the same name
|
||||
# TODO: For cross we probably need a different PYTHONPATH, or not
|
||||
# add the runtime deps until after buildPhase.
|
||||
catchConflicts ? (python.stdenv.hostPlatform == python.stdenv.buildPlatform),
|
||||
|
||||
# Additional arguments to pass to the makeWrapper function, which wraps
|
||||
# generated binaries.
|
||||
makeWrapperArgs ? [ ],
|
||||
|
||||
# Skip wrapping of python programs altogether
|
||||
dontWrapPythonPrograms ? false,
|
||||
|
||||
# Don't use Pip to install a wheel
|
||||
# Note this is actually a variable for the pipInstallPhase in pip's setupHook.
|
||||
# It's included here to prevent an infinite recursion.
|
||||
dontUsePipInstall ? false,
|
||||
|
||||
# Skip setting the PYTHONNOUSERSITE environment variable in wrapped programs
|
||||
permitUserSite ? false,
|
||||
|
||||
# Remove bytecode from bin folder.
|
||||
# When a Python script has the extension `.py`, bytecode is generated
|
||||
# Typically, executables in bin have no extension, so no bytecode is generated.
|
||||
# However, some packages do provide executables with extensions, and thus bytecode is generated.
|
||||
removeBinBytecode ? true,
|
||||
|
||||
# pyproject = true <-> format = "pyproject"
|
||||
# pyproject = false <-> format = "other"
|
||||
# https://github.com/NixOS/nixpkgs/issues/253154
|
||||
pyproject ? null,
|
||||
|
||||
# Several package formats are supported.
|
||||
# "setuptools" : Install a common setuptools/distutils based package. This builds a wheel.
|
||||
# "wheel" : Install from a pre-compiled wheel.
|
||||
# "pyproject": Install a package using a ``pyproject.toml`` file (PEP517). This builds a wheel.
|
||||
# "egg": Install a package from an egg.
|
||||
# "other" : Provide your own buildPhase and installPhase.
|
||||
format ? null,
|
||||
|
||||
meta ? { },
|
||||
|
||||
doCheck ? true,
|
||||
|
||||
...
|
||||
}@attrs:
|
||||
|
||||
let
|
||||
getFinalPassthru =
|
||||
let
|
||||
@@ -283,8 +284,7 @@ let
|
||||
name = namePrefix + attrs.name or "${finalAttrs.pname}-${finalAttrs.version}";
|
||||
|
||||
in
|
||||
(cleanAttrs attrs)
|
||||
// {
|
||||
{
|
||||
inherit name;
|
||||
|
||||
inherit catchConflicts;
|
||||
@@ -447,8 +447,7 @@ let
|
||||
"enabledTestPaths"
|
||||
"enabledTests"
|
||||
] attrs
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
# This derivation transformation function must be independent to `attrs`
|
||||
# for fixed-point arguments support in the future.
|
||||
@@ -468,6 +467,4 @@ let
|
||||
};
|
||||
in
|
||||
drv: disablePythonPackage (toPythonModule drv);
|
||||
|
||||
in
|
||||
transformDrv self
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user