treewide: replace lib/${python.libPrefix}/site-packages with its shorthand ${python.sitePackages}

which should be always preferred
This commit is contained in:
Sandro Jäckel 2023-03-24 01:30:46 +01:00
parent 30b34ac007
commit 653837881e
No known key found for this signature in database
GPG key ID: 3AF5A43A3EECC2E5
41 changed files with 62 additions and 62 deletions

View file

@ -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.

View file

@ -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
'';

View file

@ -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;

View file

@ -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'
'';

View file

@ -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}
'');

View file

@ -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

View file

@ -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;

View file

@ -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}

View file

@ -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; {

View file

@ -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"

View file

@ -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")

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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";
})
];

View file

@ -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

View file

@ -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"
'';

View file

@ -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; {

View file

@ -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; {

View file

@ -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
'';

View file

@ -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
'';

View file

@ -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 = [

View file

@ -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

View file

@ -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:

View file

@ -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 ];

View file

@ -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 = [

View file

@ -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)
'';

View file

@ -14,7 +14,7 @@ stdenv.mkDerivation {
installPhase =
''
dst=$out/lib/${python.libPrefix}/site-packages
dst=$out/${python.sitePackages}
mkdir -p $dst
cp sitecustomize.* $dst/
'';

View file

@ -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

View file

@ -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; {

View file

@ -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}\"))"
'';
});

View file

@ -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"

View file

@ -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)
'';

View file

@ -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 = [

View file

@ -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

View file

@ -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
'';

View file

@ -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
'';

View file

@ -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 \

View file

@ -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"

View file

@ -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
'';

View file

@ -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"
'';