diff --git a/doc/languages-frameworks/python.md b/doc/languages-frameworks/python.md index 50acc7f28f7..809e5146084 100644 --- a/doc/languages-frameworks/python.md +++ b/doc/languages-frameworks/python.md @@ -532,6 +532,7 @@ All parameters from `mkDerivation` function are still supported. * `makeWrapperArgs`: A list of strings. Arguments to be passed to `makeWrapper`, which wraps generated binaries. By default, the arguments to `makeWrapper` set `PATH` and `PYTHONPATH` environment variables before calling the binary. Additional arguments here can allow a developer to set environment variables which will be available when the binary is run. For example, `makeWrapperArgs = ["--set FOO BAR" "--set BAZ QUX"]`. * `installFlags`: A list of strings. Arguments to be passed to `pip install`. To pass options to `python setup.py install`, use `--install-option`. E.g., `installFlags=["--install-option='--cpp_implementation'"]. * `format`: Format of the source. Options are `setup` for when the source has a `setup.py` and `setuptools` is used to build a wheel, and `wheel` in case the source is already a binary wheel. The default value is `setup`. +* `catchConflicts` If `true`, abort package build if a package name appears more than once in dependency tree. Default is `true`. #### `buildPythonApplication` function diff --git a/pkgs/development/python-modules/generic/default.nix b/pkgs/development/python-modules/generic/default.nix index 7221bac320c..38d74e08244 100644 --- a/pkgs/development/python-modules/generic/default.nix +++ b/pkgs/development/python-modules/generic/default.nix @@ -42,6 +42,9 @@ # Additional flags to pass to "pip install". , installFlags ? [] +# Raise an error if two packages are installed with the same name +, catchConflicts ? true + , format ? "setup" , ... } @ attrs: @@ -141,7 +144,7 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled" "doCheck"] // postFixup = attrs.postFixup or '' wrapPythonPrograms - + '' + lib.optionalString catchConflicts '' # check if we have two packages with the same name in closure and fail # this shouldn't happen, something went wrong with dependencies specs ${python.interpreter} ${./catch_conflicts.py}