From 653837881ed2a27a12c7bf662be4abe9db9b7cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Fri, 24 Mar 2023 01:30:46 +0100 Subject: [PATCH 1/2] treewide: replace `lib/${python.libPrefix}/site-packages` with its shorthand `${python.sitePackages}` which should be always preferred --- doc/hooks/python.section.md | 2 +- pkgs/applications/misc/gramps/default.nix | 10 +++++----- pkgs/applications/misc/loxodo/default.nix | 2 +- pkgs/applications/networking/mkchromecast/default.nix | 4 ++-- pkgs/applications/networking/p2p/deluge/default.nix | 2 +- pkgs/applications/office/paperwork/paperwork-gtk.nix | 2 +- .../science/biology/obitools/obitools3.nix | 4 ++-- .../version-management/mercurial/default.nix | 2 +- pkgs/by-name/on/onedrivegui/package.nix | 2 +- .../libraries/science/networking/ns-3/default.nix | 2 +- pkgs/development/libraries/vigra/default.nix | 2 +- .../development/python-modules/apache-beam/default.nix | 2 +- .../python-modules/azure-common/default.nix | 2 +- .../python-modules/azure-mgmt-common/default.nix | 4 ++-- .../python-modules/backports-zoneinfo/default.nix | 2 +- .../python-modules/distutils-cfg/default.nix | 2 +- pkgs/development/python-modules/gruut-ipa/default.nix | 2 +- pkgs/development/python-modules/gurobipy/linux.nix | 2 +- .../python-modules/hg-commitsigs/default.nix | 4 ++-- pkgs/development/python-modules/kaa-base/default.nix | 10 +++++----- .../python-modules/kaa-metadata/default.nix | 10 +++++----- pkgs/development/python-modules/maestral/default.nix | 2 +- pkgs/development/python-modules/meep/default.nix | 2 +- pkgs/development/python-modules/mpi4py/default.nix | 6 +++--- pkgs/development/python-modules/pmdarima/default.nix | 2 +- pkgs/development/python-modules/pygmo/default.nix | 2 +- pkgs/development/python-modules/rdkit/default.nix | 2 +- .../python-modules/recursive-pth-loader/default.nix | 2 +- pkgs/development/python-modules/selenium/default.nix | 2 +- pkgs/development/python2-modules/pygtk/default.nix | 4 ++-- pkgs/development/r-modules/default.nix | 2 +- pkgs/development/tools/postiats-utilities/default.nix | 2 +- pkgs/servers/apache-airflow/python-package.nix | 2 +- pkgs/servers/baserow/default.nix | 4 ++-- pkgs/servers/gpsd/default.nix | 2 +- pkgs/tools/admin/gam/default.nix | 4 ++-- pkgs/tools/audio/tts/default.nix | 2 +- pkgs/tools/misc/debian-devscripts/default.nix | 2 +- .../tools/security/arubaotp-seed-extractor/default.nix | 2 +- pkgs/tools/security/hash-slinger/default.nix | 2 +- pkgs/tools/security/pass/extensions/audit/default.nix | 2 +- 41 files changed, 62 insertions(+), 62 deletions(-) diff --git a/doc/hooks/python.section.md b/doc/hooks/python.section.md index ecaae491e994..428ac24b9f7b 100644 --- a/doc/hooks/python.section.md +++ b/doc/hooks/python.section.md @@ -1,3 +1,3 @@ # Python {#setup-hook-python} -Adds the `lib/${python.libPrefix}/site-packages` subdirectory of each build input to the `PYTHONPATH` environment variable. +Adds the `${python.sitePackages}` subdirectory of each build input to the `PYTHONPATH` environment variable. diff --git a/pkgs/applications/misc/gramps/default.nix b/pkgs/applications/misc/gramps/default.nix index 173afec4aa60..25e8786dfffc 100644 --- a/pkgs/applications/misc/gramps/default.nix +++ b/pkgs/applications/misc/gramps/default.nix @@ -36,21 +36,21 @@ in buildPythonApplication rec { installPhase = '' runHook preInstall - mkdir -p "$out/lib/${python.libPrefix}/site-packages" + mkdir -p "$out/${python.sitePackages}" - export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH" + export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH" ${python}/bin/${python.executable} setup.py install \ - --install-lib=$out/lib/${python.libPrefix}/site-packages \ + --install-lib=$out/${python.sitePackages} \ --prefix="$out" - eapth="$out/lib/${python.libPrefix}"/site-packages/easy-install.pth + eapth="$out/${python.sitePackages}/easy-install.pth" if [ -e "$eapth" ]; then # move colliding easy_install.pth to specifically named one mv "$eapth" $(dirname "$eapth")/${pname}-${version}.pth fi - rm -f "$out/lib/${python.libPrefix}"/site-packages/site.py* + rm -f "$out/${python.sitePackages}"/site.py* runHook postInstall ''; diff --git a/pkgs/applications/misc/loxodo/default.nix b/pkgs/applications/misc/loxodo/default.nix index 78d01af1f08b..77dd39bc0601 100644 --- a/pkgs/applications/misc/loxodo/default.nix +++ b/pkgs/applications/misc/loxodo/default.nix @@ -22,7 +22,7 @@ python3.pkgs.buildPythonApplication { [Desktop Entry] Type=Application Exec=$out/bin/loxodo - Icon=$out/lib/${python3.libPrefix}/site-packages/resources/loxodo-icon.png + Icon=$out/${python3.sitePackages}/resources/loxodo-icon.png Name=Loxodo GenericName=Password Vault Categories=Application;Other; diff --git a/pkgs/applications/networking/mkchromecast/default.nix b/pkgs/applications/networking/mkchromecast/default.nix index fa734e7dea53..f6364f5ba572 100644 --- a/pkgs/applications/networking/mkchromecast/default.nix +++ b/pkgs/applications/networking/mkchromecast/default.nix @@ -70,11 +70,11 @@ python3Packages.buildPythonApplication { ]; postInstall = '' - substituteInPlace $out/lib/${python3Packages.python.libPrefix}/site-packages/mkchromecast/video.py \ + substituteInPlace $out/${python3Packages.python.sitePackages}/mkchromecast/video.py \ --replace '/usr/share/mkchromecast/nodejs/' '${placeholder "out"}/share/mkchromecast/nodejs/' '' + lib.optionalString stdenv.isDarwin '' install -Dm 755 -t $out/bin bin/audiodevice - substituteInPlace $out/lib/${python3Packages.python.libPrefix}/site-packages/mkchromecast/audio_devices.py \ + substituteInPlace $out/${python3Packages.python.sitePackages}/mkchromecast/audio_devices.py \ --replace './bin/audiodevice' '${placeholder "out"}/bin/audiodevice' ''; diff --git a/pkgs/applications/networking/p2p/deluge/default.nix b/pkgs/applications/networking/p2p/deluge/default.nix index 54c378a08625..35db62ef8e4e 100644 --- a/pkgs/applications/networking/p2p/deluge/default.nix +++ b/pkgs/applications/networking/p2p/deluge/default.nix @@ -77,7 +77,7 @@ let install -Dm444 -t $out/share/applications deluge/ui/data/share/applications/deluge.desktop '' else '' rm -r $out/bin/deluge-gtk - rm -r $out/lib/${python3Packages.python.libPrefix}/site-packages/deluge/ui/gtk3 + rm -r $out/${python3Packages.python.sitePackages}/deluge/ui/gtk3 rm -r $out/share/{icons,man/man1/deluge-gtk*,pixmaps} ''); diff --git a/pkgs/applications/office/paperwork/paperwork-gtk.nix b/pkgs/applications/office/paperwork/paperwork-gtk.nix index e21379678a17..e783e8f4966f 100644 --- a/pkgs/applications/office/paperwork/paperwork-gtk.nix +++ b/pkgs/applications/office/paperwork/paperwork-gtk.nix @@ -64,7 +64,7 @@ python3Packages.buildPythonApplication rec { # fixes [WARNING] [openpaperwork_core.resources.setuptools] Failed to find # resource file paperwork_gtk.icon.out/paperwork_128.png, tried at path # /nix/store/3n5lz6y8k9yks76f0nar3smc8djan3xr-paperwork-2.0.2/lib/python3.8/site-packages/paperwork_gtk/icon/out/paperwork_128.png. - site=$out/lib/${python3Packages.python.libPrefix}/site-packages/paperwork_gtk + site=$out/${python3Packages.python.sitePackages}/paperwork_gtk for i in $site/data/paperwork_*.png; do ln -s $i $site/icon/out; done diff --git a/pkgs/applications/science/biology/obitools/obitools3.nix b/pkgs/applications/science/biology/obitools/obitools3.nix index b38af2f64b54..9bf579a80c3b 100644 --- a/pkgs/applications/science/biology/obitools/obitools3.nix +++ b/pkgs/applications/science/biology/obitools/obitools3.nix @@ -17,8 +17,8 @@ python3Packages.buildPythonApplication rec { ''; preBuild = '' - substituteInPlace src/CMakeLists.txt --replace \$'{PYTHONLIB}' "$out/lib/${python3.libPrefix}/site-packages"; - export NIX_CFLAGS_COMPILE="-L $out/lib/${python3.libPrefix}/site-packages $NIX_CFLAGS_COMPILE" + substituteInPlace src/CMakeLists.txt --replace \$'{PYTHONLIB}' "$out/${python3.sitePackages}"; + export NIX_CFLAGS_COMPILE="-L $out/${python3.sitePackages} $NIX_CFLAGS_COMPILE" ''; dontConfigure = true; diff --git a/pkgs/applications/version-management/mercurial/default.nix b/pkgs/applications/version-management/mercurial/default.nix index 07cc4e7b8f58..058d01233889 100644 --- a/pkgs/applications/version-management/mercurial/default.nix +++ b/pkgs/applications/version-management/mercurial/default.nix @@ -62,7 +62,7 @@ let cp contrib/hgk $out/bin cat >> $out/etc/mercurial/hgrc << EOF [extensions] - hgk=$out/lib/${python.libPrefix}/site-packages/hgext/hgk.py + hgk=$out/${python.sitePackages}/hgext/hgk.py EOF # setting HG so that hgk can be run itself as well (not only hg view) WRAP_TK=" --set TK_LIBRARY ${tk}/lib/${tk.libPrefix} diff --git a/pkgs/by-name/on/onedrivegui/package.nix b/pkgs/by-name/on/onedrivegui/package.nix index f2db95e7dbc2..f9d1fca67539 100644 --- a/pkgs/by-name/on/onedrivegui/package.nix +++ b/pkgs/by-name/on/onedrivegui/package.nix @@ -74,7 +74,7 @@ python3Packages.buildPythonApplication rec { makeWrapper ${python3Packages.python.interpreter} $out/bin/onedrivegui \ --prefix PATH : ${lib.makeBinPath [ onedrive ]} \ --prefix PYTHONPATH : ${python3Packages.makePythonPath (propagatedBuildInputs ++ [(placeholder "out")])} \ - --add-flags $out/lib/${python3Packages.python.libPrefix}/site-packages/OneDriveGUI.py + --add-flags $out/${python3Packages.python.sitePackages}/OneDriveGUI.py ''; meta = with lib; { diff --git a/pkgs/development/libraries/science/networking/ns-3/default.nix b/pkgs/development/libraries/science/networking/ns-3/default.nix index dd28553d60e9..fa6e5e48f846 100644 --- a/pkgs/development/libraries/science/networking/ns-3/default.nix +++ b/pkgs/development/libraries/science/networking/ns-3/default.nix @@ -120,7 +120,7 @@ stdenv.mkDerivation rec { "-DPython3_EXECUTABLE=${pythonEnv}/bin/python" "-DNS3_PYTHON_BINDINGS=ON" "-DNS3_DES_METRICS=ON" - "-DNS3_BINDINGS_INSTALL_DIR=lib/${pythonEnv.libPrefix}/site-packages" + "-DNS3_BINDINGS_INSTALL_DIR=${pythonEnv.sitePackages}" "-DNS3_LOG=ON" "-DNS3_ASSERT=ON" "-DNS3_GTK3=ON" diff --git a/pkgs/development/libraries/vigra/default.nix b/pkgs/development/libraries/vigra/default.nix index 320b43f0e51b..677406d275a8 100644 --- a/pkgs/development/libraries/vigra/default.nix +++ b/pkgs/development/libraries/vigra/default.nix @@ -44,7 +44,7 @@ stdenv.mkDerivation rec { python ]; - preConfigure = "cmakeFlags+=\" -DVIGRANUMPY_INSTALL_DIR=$out/lib/${python.libPrefix}/site-packages\""; + preConfigure = "cmakeFlags+=\" -DVIGRANUMPY_INSTALL_DIR=$out/${python.sitePackages}\""; cmakeFlags = [ "-DWITH_OPENEXR=1" ] ++ lib.optionals (stdenv.hostPlatform.system == "x86_64-linux") diff --git a/pkgs/development/python-modules/apache-beam/default.nix b/pkgs/development/python-modules/apache-beam/default.nix index bd53a6f0b48a..2e267e2ef191 100644 --- a/pkgs/development/python-modules/apache-beam/default.nix +++ b/pkgs/development/python-modules/apache-beam/default.nix @@ -150,7 +150,7 @@ buildPythonPackage rec { # Make sure we're running the tests for the actually installed # package, so that cython's .so files are available. - preCheck = "cd $out/lib/${python.libPrefix}/site-packages"; + preCheck = "cd $out/${python.sitePackages}"; disabledTestPaths = [ # Fails with diff --git a/pkgs/development/python-modules/azure-common/default.nix b/pkgs/development/python-modules/azure-common/default.nix index ed4cd5243abf..2b4caa102f79 100644 --- a/pkgs/development/python-modules/azure-common/default.nix +++ b/pkgs/development/python-modules/azure-common/default.nix @@ -25,7 +25,7 @@ buildPythonPackage rec { ] ++ lib.optionals (!isPy3k) [ setuptools ]; # need for namespace lookup postInstall = lib.optionalString (!isPy3k) '' - echo "__import__('pkg_resources').declare_namespace(__name__)" >> "$out/lib/${python.libPrefix}"/site-packages/azure/__init__.py + echo "__import__('pkg_resources').declare_namespace(__name__)" >> "$out/${python.sitePackages}"/azure/__init__.py ''; doCheck = false; diff --git a/pkgs/development/python-modules/azure-mgmt-common/default.nix b/pkgs/development/python-modules/azure-mgmt-common/default.nix index 7ce7ce2c3f00..5f0390708c7d 100644 --- a/pkgs/development/python-modules/azure-mgmt-common/default.nix +++ b/pkgs/development/python-modules/azure-mgmt-common/default.nix @@ -28,8 +28,8 @@ buildPythonPackage rec { ]; postInstall = pkgs.lib.optionalString (!isPy3k) '' - echo "__import__('pkg_resources').declare_namespace(__name__)" >> "$out/lib/${python.libPrefix}"/site-packages/azure/mgmt/__init__.py - echo "__import__('pkg_resources').declare_namespace(__name__)" >> "$out/lib/${python.libPrefix}"/site-packages/azure/__init__.py + echo "__import__('pkg_resources').declare_namespace(__name__)" >> "$out/${python.sitePackages}"/azure/mgmt/__init__.py + echo "__import__('pkg_resources').declare_namespace(__name__)" >> "$out/${python.sitePackages}"/azure/__init__.py ''; doCheck = false; diff --git a/pkgs/development/python-modules/backports-zoneinfo/default.nix b/pkgs/development/python-modules/backports-zoneinfo/default.nix index ed0915eee522..ff5196855d34 100644 --- a/pkgs/development/python-modules/backports-zoneinfo/default.nix +++ b/pkgs/development/python-modules/backports-zoneinfo/default.nix @@ -46,7 +46,7 @@ buildPythonPackage rec { (substituteAll { name = "zoneinfo-path"; src = ./zoneinfo.patch; - zoneinfo = "${tzdata}/lib/${python.libPrefix}/site-packages/tzdata/zoneinfo"; + zoneinfo = "${tzdata}/${python.sitePackages}/tzdata/zoneinfo"; }) ]; diff --git a/pkgs/development/python-modules/distutils-cfg/default.nix b/pkgs/development/python-modules/distutils-cfg/default.nix index cbf12c17582a..fb616c65d036 100644 --- a/pkgs/development/python-modules/distutils-cfg/default.nix +++ b/pkgs/development/python-modules/distutils-cfg/default.nix @@ -24,7 +24,7 @@ in stdenv.mkDerivation { dontUnpack = true; installPhase = '' - dest="$out/lib/${python.libPrefix}/site-packages/distutils" + dest="$out/${python.sitePackages}/distutils" mkdir -p $dest ln -s ${python}/lib/${python.libPrefix}/distutils/* $dest ln -s ${distutilsCfg} $dest/distutils.cfg diff --git a/pkgs/development/python-modules/gruut-ipa/default.nix b/pkgs/development/python-modules/gruut-ipa/default.nix index 26a7223b97e7..bca9611b7e21 100644 --- a/pkgs/development/python-modules/gruut-ipa/default.nix +++ b/pkgs/development/python-modules/gruut-ipa/default.nix @@ -22,7 +22,7 @@ buildPythonPackage rec { postPatch = '' patchShebangs bin/* substituteInPlace bin/speak-ipa \ - --replace '${"\${src_dir}:"}' "$out/lib/${python.libPrefix}/site-packages:" \ + --replace '${"\${src_dir}:"}' "$out/${python.sitePackages}:" \ --replace "do espeak" "do ${espeak}/bin/espeak" ''; diff --git a/pkgs/development/python-modules/gurobipy/linux.nix b/pkgs/development/python-modules/gurobipy/linux.nix index e9a72cbb5cba..a7c519406e74 100644 --- a/pkgs/development/python-modules/gurobipy/linux.nix +++ b/pkgs/development/python-modules/gurobipy/linux.nix @@ -16,7 +16,7 @@ buildPythonPackage { postFixup = '' patchelf --set-rpath $out/lib \ - $out/lib/${python.libPrefix}/site-packages/gurobipy/gurobipy.so + $out/${python.sitePackages}/gurobipy/gurobipy.so ''; meta = with lib; { diff --git a/pkgs/development/python-modules/hg-commitsigs/default.nix b/pkgs/development/python-modules/hg-commitsigs/default.nix index a97c2be2b98c..7a97bff33316 100644 --- a/pkgs/development/python-modules/hg-commitsigs/default.nix +++ b/pkgs/development/python-modules/hg-commitsigs/default.nix @@ -20,9 +20,9 @@ stdenv.mkDerivation rec { dontBuild = true; installPhase = '' - mkdir -p $out/lib/${python.libPrefix}/site-packages/hgext3rd/ + mkdir -p $out/${python.sitePackages}/hgext3rd/ install -D $src/commitsigs.py \ - $out/lib/${python.libPrefix}/site-packages/hgext3rd/ + $out/${python.sitePackages}/hgext3rd/ ''; meta = with lib; { diff --git a/pkgs/development/python-modules/kaa-base/default.nix b/pkgs/development/python-modules/kaa-base/default.nix index 96c83a4ac81d..8d83bdb5b110 100644 --- a/pkgs/development/python-modules/kaa-base/default.nix +++ b/pkgs/development/python-modules/kaa-base/default.nix @@ -24,20 +24,20 @@ buildPythonPackage rec { installPhase = '' runHook preInstall - mkdir -p "$out/lib/${python.libPrefix}/site-packages" + mkdir -p "$out/${python.sitePackages}" - export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH" + export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH" ${python}/bin/${python.executable} setup.py install \ - --install-lib=$out/lib/${python.libPrefix}/site-packages \ + --install-lib=$out/${python.sitePackages} \ --prefix="$out" - eapth="$out/lib/${python.libPrefix}"/site-packages/easy-install.pth + eapth="$out/${python.sitePackages}/easy-install.pth" if [ -e "$eapth" ]; then mv "$eapth" $(dirname "$eapth")/${pname}-${version}.pth fi - rm -f "$out/lib/${python.libPrefix}"/site-packages/site.py* + rm -f "$out/${python.sitePackages}"/site.py* runHook postInstall ''; diff --git a/pkgs/development/python-modules/kaa-metadata/default.nix b/pkgs/development/python-modules/kaa-metadata/default.nix index de71d207b876..20ae66f17a9d 100644 --- a/pkgs/development/python-modules/kaa-metadata/default.nix +++ b/pkgs/development/python-modules/kaa-metadata/default.nix @@ -29,20 +29,20 @@ buildPythonPackage rec { installPhase = '' runHook preInstall - mkdir -p "$out/lib/${python.libPrefix}/site-packages" + mkdir -p "$out/${python.sitePackages}" - export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH" + export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH" ${python}/bin/${python.executable} setup.py install \ - --install-lib=$out/lib/${python.libPrefix}/site-packages \ + --install-lib=$out/${python.sitePackages} \ --prefix="$out" - eapth="$out/lib/${python.libPrefix}"/site-packages/easy-install.pth + eapth="$out/${python.sitePackages}/easy-install.pth" if [ -e "$eapth" ]; then mv "$eapth" $(dirname "$eapth")/${pname}-${version}.pth fi - rm -f "$out/lib/${python.libPrefix}"/site-packages/site.py* + rm -f "$out/${python.sitePackages}"/site.py* runHook postInstall ''; diff --git a/pkgs/development/python-modules/maestral/default.nix b/pkgs/development/python-modules/maestral/default.nix index 3e871a90562b..4645174e122f 100644 --- a/pkgs/development/python-modules/maestral/default.nix +++ b/pkgs/development/python-modules/maestral/default.nix @@ -62,7 +62,7 @@ buildPythonPackage rec { makeWrapperArgs = [ # Add the installed directories to the python path so the daemon can find them "--prefix PYTHONPATH : ${makePythonPath propagatedBuildInputs}" - "--prefix PYTHONPATH : $out/lib/${python.libPrefix}/site-packages" + "--prefix PYTHONPATH : $out/${python.sitePackages}" ]; nativeCheckInputs = [ diff --git a/pkgs/development/python-modules/meep/default.nix b/pkgs/development/python-modules/meep/default.nix index d99b5c3e2e0c..70a588f1c8aa 100644 --- a/pkgs/development/python-modules/meep/default.nix +++ b/pkgs/development/python-modules/meep/default.nix @@ -113,7 +113,7 @@ buildPythonPackage rec { checkPhase = '' runHook preCheck - export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH" + export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH" # Generate a python test script cat > test.py << EOF diff --git a/pkgs/development/python-modules/mpi4py/default.nix b/pkgs/development/python-modules/mpi4py/default.nix index f41519c00112..deb54ab149be 100644 --- a/pkgs/development/python-modules/mpi4py/default.nix +++ b/pkgs/development/python-modules/mpi4py/default.nix @@ -25,11 +25,11 @@ buildPythonPackage rec { configurePhase = ""; installPhase = '' - mkdir -p "$out/lib/${python.libPrefix}/site-packages" - export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH" + mkdir -p "$out/${python.sitePackages}" + export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH" ${python}/bin/${python.executable} setup.py install \ - --install-lib=$out/lib/${python.libPrefix}/site-packages \ + --install-lib=$out/${python.sitePackages} \ --prefix="$out" # --install-lib: diff --git a/pkgs/development/python-modules/pmdarima/default.nix b/pkgs/development/python-modules/pmdarima/default.nix index f1d152decc1f..2ddb03b8afe1 100644 --- a/pkgs/development/python-modules/pmdarima/default.nix +++ b/pkgs/development/python-modules/pmdarima/default.nix @@ -43,7 +43,7 @@ buildPythonPackage rec { # Make sure we're running the tests for the actually installed # package, so that cython's compiled files are available. preCheck = '' - cd $out/lib/${python.libPrefix}/site-packages + cd $out/${python.sitePackages} ''; nativeCheckInputs = [ pytestCheckHook ]; diff --git a/pkgs/development/python-modules/pygmo/default.nix b/pkgs/development/python-modules/pygmo/default.nix index 0ce6a2fd3f99..d311df0a4530 100644 --- a/pkgs/development/python-modules/pygmo/default.nix +++ b/pkgs/development/python-modules/pygmo/default.nix @@ -28,7 +28,7 @@ toPythonModule (stdenv.mkDerivation rec { }; cmakeFlags = [ - "-DPYGMO_INSTALL_PATH=${placeholder "out"}/lib/${python.libPrefix}/site-packages" + "-DPYGMO_INSTALL_PATH=${placeholder "out"}/${python.sitePackages}" ]; nativeBuildInputs = [ diff --git a/pkgs/development/python-modules/rdkit/default.nix b/pkgs/development/python-modules/rdkit/default.nix index 7d0632ebc836..de0bb15b8ce2 100644 --- a/pkgs/development/python-modules/rdkit/default.nix +++ b/pkgs/development/python-modules/rdkit/default.nix @@ -141,7 +141,7 @@ buildPythonPackage rec { checkPhase = '' export QT_QPA_PLATFORM='offscreen' export RDBASE=$(realpath ..) - export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH" + export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH" (cd $RDBASE/rdkit/Chem && python $RDBASE/rdkit/TestRunner.py test_list.py) ''; diff --git a/pkgs/development/python-modules/recursive-pth-loader/default.nix b/pkgs/development/python-modules/recursive-pth-loader/default.nix index 499ad3c23d07..e42988eeff9a 100644 --- a/pkgs/development/python-modules/recursive-pth-loader/default.nix +++ b/pkgs/development/python-modules/recursive-pth-loader/default.nix @@ -14,7 +14,7 @@ stdenv.mkDerivation { installPhase = '' - dst=$out/lib/${python.libPrefix}/site-packages + dst=$out/${python.sitePackages} mkdir -p $dst cp sitecustomize.* $dst/ ''; diff --git a/pkgs/development/python-modules/selenium/default.nix b/pkgs/development/python-modules/selenium/default.nix index 5a5c4304c636..09ddebebe240 100644 --- a/pkgs/development/python-modules/selenium/default.nix +++ b/pkgs/development/python-modules/selenium/default.nix @@ -34,7 +34,7 @@ buildPythonPackage rec { ''; postInstall = '' - DST_PREFIX=$out/lib/${python.libPrefix}/site-packages/selenium/webdriver/ + DST_PREFIX=$out/${python.sitePackages}/selenium/webdriver/ DST_REMOTE=$DST_PREFIX/remote/ DST_FF=$DST_PREFIX/firefox cp ../rb/lib/selenium/webdriver/atoms/getAttribute.js $DST_REMOTE diff --git a/pkgs/development/python2-modules/pygtk/default.nix b/pkgs/development/python2-modules/pygtk/default.nix index c3960dd5309d..003474ee8582 100644 --- a/pkgs/development/python2-modules/pygtk/default.nix +++ b/pkgs/development/python2-modules/pygtk/default.nix @@ -64,8 +64,8 @@ buildPythonPackage rec { postInstall = '' rm $out/bin/pygtk-codegen-2.0 ln -s ${pygobject2}/bin/pygobject-codegen-2.0 $out/bin/pygtk-codegen-2.0 - ln -s ${pygobject2}/lib/${python.libPrefix}/site-packages/pygobject-${pygobject2.version}.pth \ - $out/lib/${python.libPrefix}/site-packages/${pname}-${version}.pth + ln -s ${pygobject2}/${python.sitePackages}/pygobject-${pygobject2.version}.pth \ + $out/${python.sitePackages}/${pname}-${version}.pth ''; meta = with lib; { diff --git a/pkgs/development/r-modules/default.nix b/pkgs/development/r-modules/default.nix index 43d64f98639b..d39d0c5b8441 100644 --- a/pkgs/development/r-modules/default.nix +++ b/pkgs/development/r-modules/default.nix @@ -1304,7 +1304,7 @@ let substituteInPlace R/zzz.R \ --replace ".onLoad <- function(...) {" \ ".onLoad <- function(...) { - Sys.setenv(\"SPARK_HOME\" = Sys.getenv(\"SPARK_HOME\", unset = \"${pkgs.python3Packages.pyspark}/lib/${pkgs.python3Packages.python.libPrefix}/site-packages/pyspark\")) + Sys.setenv(\"SPARK_HOME\" = Sys.getenv(\"SPARK_HOME\", unset = \"${pkgs.python3Packages.pyspark}/${pkgs.python3Packages.python.sitePackages}/pyspark\")) Sys.setenv(\"JAVA_HOME\" = Sys.getenv(\"JAVA_HOME\", unset = \"${pkgs.jdk}\"))" ''; }); diff --git a/pkgs/development/tools/postiats-utilities/default.nix b/pkgs/development/tools/postiats-utilities/default.nix index 51d9d14efa17..6ac021e1ba09 100644 --- a/pkgs/development/tools/postiats-utilities/default.nix +++ b/pkgs/development/tools/postiats-utilities/default.nix @@ -26,7 +26,7 @@ stdenv.mkDerivation rec { ''; installPhase = '' - libdir="$out/lib/${python3.libPrefix}/site-packages" + libdir="$out/${python3.sitePackages}" mkdir -p "$libdir" cp -r postiats "$libdir" diff --git a/pkgs/servers/apache-airflow/python-package.nix b/pkgs/servers/apache-airflow/python-package.nix index ac39c99ba7d1..29559cb60a31 100644 --- a/pkgs/servers/apache-airflow/python-package.nix +++ b/pkgs/servers/apache-airflow/python-package.nix @@ -265,7 +265,7 @@ buildPythonPackage rec { ]; postInstall = '' - cp -rv ${airflow-frontend}/static/dist $out/lib/${python.libPrefix}/site-packages/airflow/www/static + cp -rv ${airflow-frontend}/static/dist $out/${python.sitePackages}/airflow/www/static # Needed for pythonImportsCheck below export HOME=$(mktemp -d) ''; diff --git a/pkgs/servers/baserow/default.nix b/pkgs/servers/baserow/default.nix index ea46b4bfb8f2..37366183dba0 100644 --- a/pkgs/servers/baserow/default.nix +++ b/pkgs/servers/baserow/default.nix @@ -127,8 +127,8 @@ with python.pkgs; buildPythonApplication rec { fixupPhase = '' cp -r src/baserow/contrib/database/{api,action,trash,formula,file_import} \ - $out/lib/${python.libPrefix}/site-packages/baserow/contrib/database/ - cp -r src/baserow/core/management/backup $out/lib/${python.libPrefix}/site-packages/baserow/core/management/ + $out/${python.sitePackages}/baserow/contrib/database/ + cp -r src/baserow/core/management/backup $out/${python.sitePackages}/baserow/core/management/ ''; disabledTests = [ diff --git a/pkgs/servers/gpsd/default.nix b/pkgs/servers/gpsd/default.nix index 662c4d530170..224ce41d185e 100644 --- a/pkgs/servers/gpsd/default.nix +++ b/pkgs/servers/gpsd/default.nix @@ -84,7 +84,7 @@ stdenv.mkDerivation rec { substituteInPlace SConscript --replace "env['CCVERSION']" "env['CC']" sconsFlags+=" udevdir=$out/lib/udev" - sconsFlags+=" python_libdir=$out/lib/${python3Packages.python.libPrefix}/site-packages" + sconsFlags+=" python_libdir=$out/${python3Packages.python.sitePackages}" ''; # - leapfetch=no disables going online at build time to fetch leap-seconds diff --git a/pkgs/tools/admin/gam/default.nix b/pkgs/tools/admin/gam/default.nix index 6ea2b6c3da37..6cf340150ffb 100644 --- a/pkgs/tools/admin/gam/default.nix +++ b/pkgs/tools/admin/gam/default.nix @@ -52,8 +52,8 @@ python3.pkgs.buildPythonApplication rec { runHook preInstall mkdir -p $out/bin cp gam.py $out/bin/gam - mkdir -p $out/lib/${python3.libPrefix}/site-packages - cp -r gam $out/lib/${python3.libPrefix}/site-packages + mkdir -p $out/${python3.sitePackages} + cp -r gam $out/${python3.sitePackages} runHook postInstall ''; diff --git a/pkgs/tools/audio/tts/default.nix b/pkgs/tools/audio/tts/default.nix index 48c936ca632f..d761e4605190 100644 --- a/pkgs/tools/audio/tts/default.nix +++ b/pkgs/tools/audio/tts/default.nix @@ -128,7 +128,7 @@ python.pkgs.buildPythonApplication rec { for file in $(grep -rl 'python TTS/bin' tests); do substituteInPlace "$file" \ - --replace "python TTS/bin" "${python.interpreter} $out/lib/${python.libPrefix}/site-packages/TTS/bin" + --replace "python TTS/bin" "${python.interpreter} $out/${python.sitePackages}/TTS/bin" done ''; diff --git a/pkgs/tools/misc/debian-devscripts/default.nix b/pkgs/tools/misc/debian-devscripts/default.nix index b8a58ff400e2..d70994753dbd 100644 --- a/pkgs/tools/misc/debian-devscripts/default.nix +++ b/pkgs/tools/misc/debian-devscripts/default.nix @@ -39,7 +39,7 @@ in stdenv.mkDerivation rec { preConfigure = '' export PERL5LIB="$PERL5LIB''${PERL5LIB:+:}${dpkg}"; - tgtpy="$out/lib/${python.libPrefix}/site-packages" + tgtpy="$out/${python.sitePackages}" mkdir -p "$tgtpy" export PYTHONPATH="$PYTHONPATH''${PYTHONPATH:+:}$tgtpy" find lib po4a scripts -type f -exec sed -r \ diff --git a/pkgs/tools/security/arubaotp-seed-extractor/default.nix b/pkgs/tools/security/arubaotp-seed-extractor/default.nix index a1ab0fd9f290..c2ffef83635d 100644 --- a/pkgs/tools/security/arubaotp-seed-extractor/default.nix +++ b/pkgs/tools/security/arubaotp-seed-extractor/default.nix @@ -28,7 +28,7 @@ python3Packages.buildPythonApplication { ]; installPhase = '' - libdir="$out/lib/${python3Packages.python.libPrefix}/site-packages/arubaotp-seed-extractor" + libdir="$out/${python3Packages.python.sitePackages}/arubaotp-seed-extractor" mkdir -p "$libdir" cp scripts/* "$libdir" chmod +x "$libdir/main.py" diff --git a/pkgs/tools/security/hash-slinger/default.nix b/pkgs/tools/security/hash-slinger/default.nix index 0f0eeeb6b2af..cb02b806a986 100644 --- a/pkgs/tools/security/hash-slinger/default.nix +++ b/pkgs/tools/security/hash-slinger/default.nix @@ -49,7 +49,7 @@ stdenv.mkDerivation rec { ''; installPhase = '' - mkdir -p $out/bin $out/man $out/lib/${python3.libPrefix}/site-packages + mkdir -p $out/bin $out/man $out/${python3.sitePackages} make install wrapPythonPrograms ''; diff --git a/pkgs/tools/security/pass/extensions/audit/default.nix b/pkgs/tools/security/pass/extensions/audit/default.nix index 74e9dab46a7e..365f81759cce 100644 --- a/pkgs/tools/security/pass/extensions/audit/default.nix +++ b/pkgs/tools/security/pass/extensions/audit/default.nix @@ -41,7 +41,7 @@ in stdenv.mkDerivation rec { installFlags = [ "DESTDIR=${placeholder "out"}" "PREFIX=" ]; postInstall = '' wrapProgram $out/lib/password-store/extensions/audit.bash \ - --prefix PYTHONPATH : "$out/lib/${pythonEnv.libPrefix}/site-packages" \ + --prefix PYTHONPATH : "$out/${pythonEnv.sitePackages}" \ --run "export COMMAND" ''; From 9cf8b8bab36f0574fdb455812ccfe6f7c28f7f9b Mon Sep 17 00:00:00 2001 From: Sandro Date: Wed, 31 Jan 2024 14:34:19 +0100 Subject: [PATCH 2/2] doc: clarify python.sitePackages Co-authored-by: Peder Bergebakken Sundt --- doc/hooks/python.section.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/hooks/python.section.md b/doc/hooks/python.section.md index 428ac24b9f7b..b7862650f167 100644 --- a/doc/hooks/python.section.md +++ b/doc/hooks/python.section.md @@ -1,3 +1,3 @@ # Python {#setup-hook-python} -Adds the `${python.sitePackages}` subdirectory of each build input to the `PYTHONPATH` environment variable. +Adds the `python.sitePackages` subdirectory (i.e. `lib/pythonX.Y/site-packages`) of each build input to the `PYTHONPATH` environment variable.