From 26f09762a84387d1891f2effeb6f5071ff921b4f Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Wed, 9 Oct 2024 18:14:29 +0800 Subject: [PATCH 01/14] pytestCheckHook: support __structuredAttrs Add flag pytestFlags as the new, conforming interface replacing pytestFlagsArray. Stop Bash-expanding disabledTests and disabledTestPaths. Handle disabledTestPaths with `pytest --ignore-glob ` to keep globbing support. Check if each path glob matches at least one path using the `glob` module from the Python standard library. Also make buildPythonPackage and buildPythonApplication stop escaping the elements of disabledTests and disabledTestPaths. --- doc/languages-frameworks/python.section.md | 12 +++-- .../python/hooks/pytest-check-hook.sh | 44 +++++++++++-------- .../python/mk-python-derivation.nix | 8 ++-- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md index 8cb52ba298615..5e2a4d0d56c5f 100644 --- a/doc/languages-frameworks/python.section.md +++ b/doc/languages-frameworks/python.section.md @@ -1273,7 +1273,7 @@ Using the example above, the analogous `pytestCheckHook` usage would be: ]; # requires additional data - pytestFlagsArray = [ + pytestFlags = [ "tests/" "--ignore=tests/integration" ]; @@ -2002,7 +2002,7 @@ Occasionally packages don't make use of a common test framework, which may then * Non-working tests can often be deselected. Most Python modules do follow the standard test protocol where the pytest runner can be used. - `pytest` supports the `-k` and `--ignore` parameters to ignore test + `pytest` supports the `-k` and `--ignore-glob` parameters to ignore test methods or classes as well as whole files. For `pytestCheckHook` these are conveniently exposed as `disabledTests` and `disabledTestPaths` respectively. @@ -2019,11 +2019,17 @@ Occasionally packages don't make use of a common test framework, which may then ]; disabledTestPaths = [ - "this/file.py" + "path/to/performance.py" + "path/to/connect-*.py" ]; } ``` + ::: {.note} + If the test path to disable contains characters like `*`, `?`, `[`, and `]`, + quote them with square brackets (`[*]`, `[?]`, `[[]`, and `[]]`) to match literally. + ::: + * Tests that attempt to access `$HOME` can be fixed by using the following work-around before running tests (e.g. `preCheck`): `export HOME=$(mktemp -d)` * Compiling with Cython causes tests to fail with a `ModuleNotLoadedError`. diff --git a/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh b/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh index b542398a92b0a..3c0bb623b2f91 100644 --- a/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh +++ b/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh @@ -1,33 +1,41 @@ # Setup hook for pytest -echo "Sourcing pytest-check-hook" -declare -ar disabledTests -declare -a disabledTestPaths +echo "Sourcing pytest-check-hook" function pytestCheckPhase() { echo "Executing pytestCheckPhase" runHook preCheck # Compose arguments - args=" -m pytest" - if [ -n "$disabledTests" ]; then + local -a flagsArray=(-m pytest) + if [ -n "${disabledTests[*]-}" ]; then disabledTestsString="not $(concatStringsSep " and not " disabledTests)" - args+=" -k \""$disabledTestsString"\"" - fi - - if [ -n "${disabledTestPaths-}" ]; then - eval "disabledTestPaths=($disabledTestPaths)" + flagsArray+=(-k "$disabledTestsString") fi - for path in ${disabledTestPaths[@]}; do - if [ ! -e "$path" ]; then - echo "Disabled tests path \"$path\" does not exist. Aborting" - exit 1 - fi - args+=" --ignore=\"$path\"" + local -a _pathsArray=() + concatTo _pathsArray disabledTestPaths + for path in "${_pathsArray[@]}"; do + # Check if every path glob matches at least one path + @pythonCheckInterpreter@ <(cat < Date: Fri, 20 Dec 2024 01:53:37 +0800 Subject: [PATCH 02/14] python3Packages.pytest-xdist: use pytestFlags --- pkgs/development/python-modules/pytest-xdist/default.nix | 2 +- pkgs/development/python-modules/pytest-xdist/setup-hook.sh | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pkgs/development/python-modules/pytest-xdist/default.nix b/pkgs/development/python-modules/pytest-xdist/default.nix index 972d0bdf23c71..5660820d969c3 100644 --- a/pkgs/development/python-modules/pytest-xdist/default.nix +++ b/pkgs/development/python-modules/pytest-xdist/default.nix @@ -47,7 +47,7 @@ buildPythonPackage rec { # pytest can already use xdist at this point preCheck = '' - appendToVar pytestFlagsArray "--numprocesses=$NIX_BUILD_CORES" + appendToVar pytestFlags "--numprocesses=$NIX_BUILD_CORES" ''; # access file system diff --git a/pkgs/development/python-modules/pytest-xdist/setup-hook.sh b/pkgs/development/python-modules/pytest-xdist/setup-hook.sh index 8600ce998acc4..30f8af1ba181d 100644 --- a/pkgs/development/python-modules/pytest-xdist/setup-hook.sh +++ b/pkgs/development/python-modules/pytest-xdist/setup-hook.sh @@ -1,7 +1,5 @@ pytestXdistHook() { - pytestFlagsArray+=( - "--numprocesses=$NIX_BUILD_CORES" - ) + appendToVar pytestFlags "--numprocesses=$NIX_BUILD_CORES" } if [ -z "${dontUsePytestXdist-}" ] && [ -z "${dontUsePytestCheck-}" ]; then From 9bf387aa9d4bc4039accab9e301ae2cd9c98b0ca Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Fri, 20 Dec 2024 01:54:54 +0800 Subject: [PATCH 03/14] python3Packages.pytest-forked: use pytestFlags --- pkgs/development/python-modules/pytest-forked/setup-hook.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/pytest-forked/setup-hook.sh b/pkgs/development/python-modules/pytest-forked/setup-hook.sh index 88ccd0aac171b..360ddfdfdaf57 100644 --- a/pkgs/development/python-modules/pytest-forked/setup-hook.sh +++ b/pkgs/development/python-modules/pytest-forked/setup-hook.sh @@ -1,7 +1,5 @@ pytestForkedHook() { - pytestFlagsArray+=( - "--forked" - ) + appendToVar pytestFlags "--forked" # Using --forked on darwin leads to crashes when fork safety is # enabled. This often happens when urllib tries to request proxy From ec6f585f05963c59433fbbf6337d35c51fc475d1 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Mon, 7 Oct 2024 07:06:51 +0800 Subject: [PATCH 04/14] pytestCheckHook: lint with ShellCheck --- pkgs/development/interpreters/python/hooks/pytest-check-hook.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh b/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh index 3c0bb623b2f91..855c770e31b18 100644 --- a/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh +++ b/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh @@ -1,4 +1,5 @@ # Setup hook for pytest +# shellcheck shell=bash echo "Sourcing pytest-check-hook" From d8c36cb25232bb661ccf373a8911910690aa7e92 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Mon, 7 Oct 2024 08:27:09 +0800 Subject: [PATCH 05/14] setuptoolsBuildHook: support __structuredAttrs Handle flags with appendToVar and concatTo. Stop Bash-expanding elements of setupPyGlobalFlags and setupPyBuildFlags. --- .../python/hooks/setuptools-build-hook.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh b/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh index 4c63a18eca43c..7f20b1ab2c617 100644 --- a/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh +++ b/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh @@ -3,23 +3,25 @@ echo "Sourcing setuptools-build-hook" setuptoolsBuildPhase() { echo "Executing setuptoolsBuildPhase" - local args setuptools_has_parallel=@setuptools_has_parallel@ + local setuptools_has_parallel=@setuptools_has_parallel@ runHook preBuild cp -f @setuppy@ nix_run_setup - args="" - if [ -n "$setupPyGlobalFlags" ]; then - args+="$setupPyGlobalFlags" + local -a flagsArray=() + if [ -n "${setupPyGlobalFlags[*]-}" ]; then + concatTo flagsArray setupPyGlobalFlags fi if [ -n "$enableParallelBuilding" ]; then if [ -n "$setuptools_has_parallel" ]; then - setupPyBuildFlags+=" --parallel $NIX_BUILD_CORES" + appendToVar setupPyBuildFlags --parallel "$NIX_BUILD_CORES" fi fi - if [ -n "$setupPyBuildFlags" ]; then - args+=" build_ext $setupPyBuildFlags" + if [ -n "${setupPyBuildFlags[*]-}" ]; then + flagsArray+=(build_ext) + concatTo flagsArray setupPyBuildFlags fi - eval "@pythonInterpreter@ nix_run_setup $args bdist_wheel" + echoCmd 'setup.py build flags' "${flagsArray[@]}" + @pythonInterpreter@ nix_run_setup "${flagsArray[@]}" bdist_wheel runHook postBuild echo "Finished executing setuptoolsBuildPhase" From 1c9b35c2483d4c2f8cc0f2416c8539d509f02274 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Thu, 19 Dec 2024 06:55:16 +0800 Subject: [PATCH 06/14] python3packages.mysql-connector: specify setupPyBuildFlags directly without expecting Bash expansion --- .../python-modules/mysql-connector/default.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkgs/development/python-modules/mysql-connector/default.nix b/pkgs/development/python-modules/mysql-connector/default.nix index e234bbef0e18d..be6966cd9a1ee 100644 --- a/pkgs/development/python-modules/mysql-connector/default.nix +++ b/pkgs/development/python-modules/mysql-connector/default.nix @@ -18,10 +18,11 @@ buildPythonPackage rec { disabled = pythonOlder "3.7"; setupPyBuildFlags = [ - "--with-mysql-capi=\"${mysql80}\"" - "--with-openssl-include-dir=\"${openssl.dev}/include\"" - "--with-openssl-lib-dir=\"${lib.getLib openssl}/lib\"" - "-L \"${lib.getLib pkgs.zstd}/lib:${lib.getLib mysql80}/lib\"" + "--with-mysql-capi=${mysql80}" + "--with-openssl-include-dir=${openssl.dev}/include" + "--with-openssl-lib-dir=${lib.getLib openssl}/lib" + "-L" + "${lib.getLib pkgs.zstd}/lib:${lib.getLib mysql80}/lib" ]; src = fetchFromGitHub { From 71e47c958d46e4e7ac5a440754dad785904a944a Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Tue, 17 Dec 2024 22:02:44 +0800 Subject: [PATCH 07/14] python3Packages.vowpalwabbit: specify setupPyBuildFlags without Bash-expanding expection --- pkgs/development/python-modules/vowpalwabbit/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/vowpalwabbit/default.nix b/pkgs/development/python-modules/vowpalwabbit/default.nix index 5dbf58739c750..10187ec4eb336 100644 --- a/pkgs/development/python-modules/vowpalwabbit/default.nix +++ b/pkgs/development/python-modules/vowpalwabbit/default.nix @@ -42,7 +42,7 @@ buildPythonPackage rec { # As we disable configure via cmake, pass explicit global options to enable # spdlog and fmt packages - setupPyGlobalFlags = [ "--cmake-options=\"-DSPDLOG_SYS_DEP=ON;-DFMT_SYS_DEP=ON\"" ]; + setupPyGlobalFlags = [ "--cmake-options=-DSPDLOG_SYS_DEP=ON;-DFMT_SYS_DEP=ON" ]; propagatedBuildInputs = [ numpy From 76f6a3b292553fc95631fa54f90aed4ff87ffcbc Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Mon, 7 Oct 2024 08:17:24 +0800 Subject: [PATCH 08/14] setuptoolsBuildHook: lint with ShellCheck --- .../interpreters/python/hooks/setuptools-build-hook.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh b/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh index 7f20b1ab2c617..9f2185265b12f 100644 --- a/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh +++ b/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh @@ -1,4 +1,6 @@ # Setup hook for setuptools. +# shellcheck shell=bash + echo "Sourcing setuptools-build-hook" setuptoolsBuildPhase() { From 1e8f39148abbc0fc4d446b088019364d1995c689 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Mon, 7 Oct 2024 08:37:10 +0800 Subject: [PATCH 09/14] unittestCheckHook: handle unittestFlagsArray `__structuredAttrs`-agnostically Take unittestFlags as the new and conforming interface. Keep unittestFlagsArray as is. --- doc/languages-frameworks/python.section.md | 2 +- .../interpreters/python/hooks/unittest-check-hook.sh | 9 ++++++++- .../interpreters/python/mk-python-derivation.nix | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md index 5e2a4d0d56c5f..cee0882ce6ccb 100644 --- a/doc/languages-frameworks/python.section.md +++ b/doc/languages-frameworks/python.section.md @@ -1433,7 +1433,7 @@ automatically add `pythonRelaxDepsHook` if either `pythonRelaxDeps` or unittestCheckHook ]; - unittestFlagsArray = [ + unittestFlags = [ "-s" "tests" "-v" ]; } diff --git a/pkgs/development/interpreters/python/hooks/unittest-check-hook.sh b/pkgs/development/interpreters/python/hooks/unittest-check-hook.sh index 64ecb13cbc718..8795b680a310e 100644 --- a/pkgs/development/interpreters/python/hooks/unittest-check-hook.sh +++ b/pkgs/development/interpreters/python/hooks/unittest-check-hook.sh @@ -5,7 +5,14 @@ unittestCheckPhase() { echo "Executing unittestCheckPhase" runHook preCheck - eval "@pythonCheckInterpreter@ -m unittest discover $unittestFlagsArray" + local -a flagsArray=() + + # Compatibility layer to the obsolete unittestFlagsArray + eval "flagsArray+=(${unittestFlagsArray[*]-})" + + concatTo flagsArray unittestFlags + echoCmd 'unittest flags' "${flagsArray[@]}" + @pythonCheckInterpreter@ -m unittest discover "${flagsArray[@]}" runHook postCheck echo "Finished executing unittestCheckPhase" diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix index 7b1e212bbaf97..4aea3d8fe5e81 100644 --- a/pkgs/development/interpreters/python/mk-python-derivation.nix +++ b/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -108,6 +108,7 @@ let "disabledTests" "pytestFlags" "pytestFlagsArray" + "unittestFlags" "unittestFlagsArray" "outputs" "stdenv" @@ -446,6 +447,9 @@ let // optionalAttrs (attrs ? pytestFlagsArray) { pytestFlagsArray = attrs.pytestFlagsArray; } + // optionalAttrs (attrs ? unittestFlags) { + unittestFlags = attrs.unittestFlags; + } // optionalAttrs (attrs ? unittestFlagsArray) { unittestFlagsArray = attrs.unittestFlagsArray; } From 9b07602c8e09a97f030986052a7841e3e2bb9bc8 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Mon, 28 Oct 2024 03:15:02 +0800 Subject: [PATCH 10/14] unittestCheckHook: lint with ShellCheck --- .../interpreters/python/hooks/unittest-check-hook.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/python/hooks/unittest-check-hook.sh b/pkgs/development/interpreters/python/hooks/unittest-check-hook.sh index 8795b680a310e..3ee947e278e66 100644 --- a/pkgs/development/interpreters/python/hooks/unittest-check-hook.sh +++ b/pkgs/development/interpreters/python/hooks/unittest-check-hook.sh @@ -1,4 +1,6 @@ # Setup hook for unittest. +# shellcheck shell=bash + echo "Sourcing unittest-check-hook" unittestCheckPhase() { @@ -18,7 +20,7 @@ unittestCheckPhase() { echo "Finished executing unittestCheckPhase" } -if [ -z "${dontUseUnittestCheck-}" ] && [ -z "${installCheckPhase-}" ]; then +if [[ -z "${dontUseUnittestCheck-}" ]] && [[ -z "${installCheckPhase-}" ]]; then echo "Using unittestCheckPhase" appendToVar preDistPhases unittestCheckPhase fi From 8be69aee9687540bda6f48e5bfdb8e01fb73de2d Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Sat, 21 Dec 2024 20:08:53 +0800 Subject: [PATCH 11/14] doc: python: elaborate the makeWrapperArgs behaviour --- doc/languages-frameworks/python.section.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md index cee0882ce6ccb..c25cccf2ecf1a 100644 --- a/doc/languages-frameworks/python.section.md +++ b/doc/languages-frameworks/python.section.md @@ -183,7 +183,15 @@ following are specific to `buildPythonPackage`: [`makeWrapper`](#fun-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"]`. + `makeWrapperArgs = ["--set" "FOO" "BAR" "--set" "BAZ" "QUX"]`. + + ::: {.note} + When `__structuredAttrs = false`, the attribute `makeWrapperArgs` is passed as a space-separated string to the build script. Developers should use `prependToVar` or `appendToVar` to add arguments to it in build phases, or use `__structuredAttrs = true` to ensure that `makeWrapperArgs` is passed as a Bash array. + + For compatibility purposes, + when `makeWrapperArgs` shell variable is specified as a space-separated string (instead of a Bash array) in the build script, the string content is Bash-expanded before concatenated into the `wrapProgram` command. Still, developers should not rely on such behaviours, but use `__structuredAttrs = true` to specify flags containing spaces (e.g. `makeWrapperArgs = [ "--set" "GREETING" "Hello, world!" ]`), or use -pre and -post phases to specify flags with Bash-expansions (e.g. `preFixup = ''makeWrapperArgs+=(--prefix PATH : "$SOME_PATH")`''). + ::: + * `namePrefix`: Prepends text to `${name}` parameter. In case of libraries, this defaults to `"python3.8-"` for Python 3.8, etc., and in case of applications to `""`. * `pypaBuildFlags ? []`: A list of strings. Arguments to be passed to `python -m build --wheel`. From 4fae2f59eeb9128d4c9021a063d34e62a5592d3b Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Tue, 17 Dec 2024 07:09:33 +0800 Subject: [PATCH 12/14] rl-2505.section.md: add entries about buildPython*'s __structuredAttrs support --- nixos/doc/manual/release-notes/rl-2505.section.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nixos/doc/manual/release-notes/rl-2505.section.md b/nixos/doc/manual/release-notes/rl-2505.section.md index eb15f1c4b8e9b..e121e095db0fe 100644 --- a/nixos/doc/manual/release-notes/rl-2505.section.md +++ b/nixos/doc/manual/release-notes/rl-2505.section.md @@ -22,6 +22,8 @@ - The default Elixir version has been updated to 1.18. +- `buildPythonPackage`, `buildPythonApplication` and the Python building setup hooks now support both `__structuredAttrs = true` and `__structuredAttrs = false`. + - `services.dex` now restarts upon changes to the `.environmentFile` or entries in `.settings.staticClients[].secretFile` when the entry is a `path` type. - `nixos-rebuild-ng`, a full rewrite of `nixos-rebuild` in Python, is available for testing. You can enable it by setting [system.rebuild.enableNg](options.html#opt-system.rebuild.enableNg) in your configuration (this will replace the old `nixos-rebuild`), or by adding `nixos-rebuild-ng` to your `environment.systemPackages` (in this case, it will live side-by-side with `nixos-rebuild` as `nixos-rebuild-ng`). It is expected that the next major version of NixOS (25.11) will enable `system.rebuild.enableNg` by default. @@ -120,6 +122,16 @@ instead of the python tester launcher. You can still refer to the python launcher via `python3Packages.toPythonApplication python3Packages.playwright` +- The representation of the flags attributes as shell/environment variables for most Python building setup hooks are now the same as `stdenv.mkDerivation` and other build helpers -- they are space-separated environment variables when `__structuredAttrs = false` and Bash arrays when `__structuredAttrs = true`, and are concatenated to the command without Bash-evaluation. The following behaviour changes are introduced during the conversion: + + - The following flags are no longer Bash-expanded before concatenated to the command: + - `disabledTests` and `disabledTestPaths` for `pytestCheckHook`. (`disabledTestPaths` used to be expanded twice before concatenation.) + - `setupPyBuildFlags` and `setupPyGlobalFlags` for `setuptoolsBuildHook`. + + - `pytestFlags` and `unittestFlags` replace `pytestFlagsArray` and `unittestFlagsArray` and become the new and conforming interface. + + - `pytestFlagsArray` and `unittestFlagsArray` are kept for compatibility purposes. They continue to be Bash-expanded before concatenated. This compatibility layer will be removed in future releases. + - `strawberry` has been updated to 1.2, which drops support for the VLC backend and Qt 5. The `strawberry-qt5` package and `withGstreamer`/`withVlc` override options have been removed due to this. From 53da12177e3e6674872f7890665636591eda05d7 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Sat, 21 Dec 2024 20:49:02 +0800 Subject: [PATCH 13/14] python3Packages.conda: use __structuredAttrs = true --- pkgs/development/python-modules/conda/default.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/conda/default.nix b/pkgs/development/python-modules/conda/default.nix index b1942a35a2560..7de699646cef6 100644 --- a/pkgs/development/python-modules/conda/default.nix +++ b/pkgs/development/python-modules/conda/default.nix @@ -26,6 +26,7 @@ defaultPkgPath ? "~/.conda/pkgs", # default path to store download conda packages }: buildPythonPackage rec { + __structuredAttrs = true; pname = "conda"; version = "24.7.1"; pyproject = true; @@ -63,9 +64,17 @@ buildPythonPackage rec { patches = [ ./0001-conda_exe.patch ]; makeWrapperArgs = [ - "--set CONDA_EXE ${placeholder "out"}/bin/conda" - ''--set-default CONDA_ENVS_PATH "${defaultEnvPath}"'' - ''--set-default CONDA_PKGS_DIRS "${defaultPkgPath}"'' + "--set" + "CONDA_EXE" + "${placeholder "out"}/bin/conda" + + "--set-default" + "CONDA_ENVS_PATH" + defaultEnvPath + + "--set-default" + "CONDA_PKGS_DIRS" + defaultPkgPath ]; pythonImportsCheck = [ "conda" ]; From 625cf90466022be8a17879224ff90daa6d38b5af Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Sat, 21 Dec 2024 20:50:50 +0800 Subject: [PATCH 14/14] python3Packages.tensorflow: use __structuredAttrs = true --- pkgs/development/python-modules/tensorflow/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/tensorflow/default.nix b/pkgs/development/python-modules/tensorflow/default.nix index ac2430d1a2b64..e3081deb2f92d 100644 --- a/pkgs/development/python-modules/tensorflow/default.nix +++ b/pkgs/development/python-modules/tensorflow/default.nix @@ -607,6 +607,7 @@ let }; in buildPythonPackage { + __structuredAttrs = true; inherit version pname; disabled = pythonAtLeast "3.12"; @@ -636,7 +637,10 @@ buildPythonPackage { rm $out/bin/tensorboard ''; - setupPyGlobalFlags = [ "--project_name ${pname}" ]; + setupPyGlobalFlags = [ + "--project_name" + pname + ]; # tensorflow/tools/pip_package/setup.py propagatedBuildInputs = [