Merge pull request #218500 from alyssais/pythonForBuild

This commit is contained in:
Artturi
2023-02-27 18:17:27 +02:00
committed by GitHub
37 changed files with 48 additions and 49 deletions

View File

@@ -1019,7 +1019,7 @@ buildPythonPackage rec {
The `buildPythonPackage` mainly does four things: The `buildPythonPackage` mainly does four things:
* In the `buildPhase`, it calls `${python.interpreter} setup.py bdist_wheel` to * In the `buildPhase`, it calls `${python.pythonForBuild.interpreter} setup.py bdist_wheel` to
build a wheel binary zipfile. build a wheel binary zipfile.
* In the `installPhase`, it installs the wheel file using `pip install *.whl`. * In the `installPhase`, it installs the wheel file using `pip install *.whl`.
* In the `postFixup` phase, the `wrapPythonPrograms` bash function is called to * In the `postFixup` phase, the `wrapPythonPrograms` bash function is called to
@@ -1546,7 +1546,7 @@ of such package using the feature is `pkgs/tools/X11/xpra/default.nix`.
As workaround install it as an extra `preInstall` step: As workaround install it as an extra `preInstall` step:
```shell ```shell
${python.interpreter} setup.py install_data --install-dir=$out --root=$out ${python.pythonForBuild.interpreter} setup.py install_data --install-dir=$out --root=$out
sed -i '/ = data\_files/d' setup.py sed -i '/ = data\_files/d' setup.py
``` ```

View File

@@ -149,7 +149,7 @@ stdenv.mkDerivation rec {
export XDG_DATA_HOME=$out/share export XDG_DATA_HOME=$out/share
export XDG_UTILS_INSTALL_MODE="user" export XDG_UTILS_INSTALL_MODE="user"
${python3Packages.python.interpreter} setup.py install --root=$out \ ${python3Packages.python.pythonForBuild.interpreter} setup.py install --root=$out \
--prefix=$out \ --prefix=$out \
--libdir=$out/lib \ --libdir=$out/lib \
--staging-root=$out \ --staging-root=$out \

View File

@@ -26,7 +26,7 @@ python3Packages.buildPythonApplication rec {
outputs = [ "out" "doc" ]; outputs = [ "out" "doc" ];
postBuild = '' postBuild = ''
${python3Packages.python.interpreter} setup.py build_sphinx -b html,man ${python3Packages.python.pythonForBuild.interpreter} setup.py build_sphinx -b html,man
''; '';
postInstall = '' postInstall = ''

View File

@@ -23,7 +23,7 @@ python3Packages.buildPythonApplication rec {
]; ];
buildPhase = '' buildPhase = ''
${python3Packages.python.interpreter} -O -m compileall . ${python3Packages.python.pythonForBuild.interpreter} -O -m compileall .
''; '';
installPhase = '' installPhase = ''

View File

@@ -18,7 +18,7 @@ python3Packages.buildPythonApplication rec {
]; ];
buildPhase = '' buildPhase = ''
${python3Packages.python.interpreter} -O -m compileall . ${python3Packages.python.pythonForBuild.interpreter} -O -m compileall .
''; '';
installPhase = '' installPhase = ''

View File

@@ -244,13 +244,13 @@ python.pkgs.buildPythonApplication rec {
postBuild = '' postBuild = ''
# Compile manually because `pythonRecompileBytecodeHook` only works # Compile manually because `pythonRecompileBytecodeHook` only works
# for files in `python.sitePackages` # for files in `python.sitePackages`
${python.interpreter} -OO -m compileall src ${python.pythonForBuild.interpreter} -OO -m compileall src
# Collect static files # Collect static files
${python.interpreter} src/manage.py collectstatic --clear --no-input ${python.pythonForBuild.interpreter} src/manage.py collectstatic --clear --no-input
# Compile string translations using gettext # Compile string translations using gettext
${python.interpreter} src/manage.py compilemessages ${python.pythonForBuild.interpreter} src/manage.py compilemessages
''; '';
installPhase = '' installPhase = ''

View File

@@ -27,7 +27,7 @@ pythonPackages.buildPythonApplication rec {
--replace "/bin/bash" "${bash}/bin/bash" --replace "/bin/bash" "${bash}/bin/bash"
mkdir -p "$out/${python.sitePackages}" mkdir -p "$out/${python.sitePackages}"
export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH" export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH"
${python.interpreter} setup.py install \ ${python.pythonForBuild.interpreter} setup.py install \
--install-lib=$out/${python.sitePackages} \ --install-lib=$out/${python.sitePackages} \
--prefix="$out" --prefix="$out"
''; '';

View File

@@ -47,7 +47,7 @@ let common = { version, sha256, patches ? [ ], tag ? "z3" }:
configurePhase = concatStringsSep " " configurePhase = concatStringsSep " "
( (
[ "${python.interpreter} scripts/mk_make.py --prefix=$out" ] [ "${python.pythonForBuild.interpreter} scripts/mk_make.py --prefix=$out" ]
++ optional javaBindings "--java" ++ optional javaBindings "--java"
++ optional ocamlBindings "--ml" ++ optional ocamlBindings "--ml"
++ optional pythonBindings "--python --pypkgdir=$out/${python.sitePackages}" ++ optional pythonBindings "--python --pypkgdir=$out/${python.sitePackages}"

View File

@@ -59,14 +59,14 @@ stdenv.mkDerivation rec {
buildPhase = with python3.pkgs; '' buildPhase = with python3.pkgs; ''
runHook preBuild runHook preBuild
${python.interpreter} module/setup.py build --parallel=$NIX_BUILD_CORES ${python.pythonForBuild.interpreter} module/setup.py build --parallel=$NIX_BUILD_CORES
runHook postBuild runHook postBuild
''; '';
installPhase = with python3.pkgs; '' installPhase = with python3.pkgs; ''
runHook preInstall runHook preInstall
${python.interpreter} module/setup.py install --prefix=$out ${python.pythonForBuild.interpreter} module/setup.py install --prefix=$out
mkdir -p $out/share/renpy mkdir -p $out/share/renpy
cp -vr sdk-fonts gui launcher renpy the_question tutorial renpy.py $out/share/renpy cp -vr sdk-fonts gui launcher renpy the_question tutorial renpy.py $out/share/renpy

View File

@@ -82,8 +82,8 @@ stdenv.mkDerivation rec {
export OPENMM_LIB_PATH=$out/lib export OPENMM_LIB_PATH=$out/lib
export OPENMM_INCLUDE_PATH=$out/include export OPENMM_INCLUDE_PATH=$out/include
cd python cd python
${python3Packages.python.interpreter} setup.py build ${python3Packages.python.pythonForBuild.interpreter} setup.py build
${python3Packages.python.interpreter} setup.py install --prefix=$out ${python3Packages.python.pythonForBuild.interpreter} setup.py install --prefix=$out
''; '';
postFixup = '' postFixup = ''

View File

@@ -43,7 +43,7 @@ buildPythonPackage rec {
''; '';
postInstall = '' postInstall = ''
${python.interpreter} -m bash_kernel.install --prefix $out ${python.pythonForBuild.interpreter} -m bash_kernel.install --prefix $out
''; '';
meta = { meta = {

View File

@@ -20,7 +20,7 @@ buildPythonPackage rec {
# workaround https://github.com/idank/bashlex/issues/51 # workaround https://github.com/idank/bashlex/issues/51
preBuild = '' preBuild = ''
${python.interpreter} -c 'import bashlex' ${python.pythonForBuild.interpreter} -c 'import bashlex'
''; '';
nativeCheckInputs = [ nativeCheckInputs = [

View File

@@ -49,7 +49,7 @@ buildPythonPackage rec {
''; '';
preBuild = '' preBuild = ''
${python.interpreter} setup.py build_ext --inplace ${python.pythonForBuild.interpreter} setup.py build_ext --inplace
''; '';
pythonImportsCheck = [ pythonImportsCheck = [

View File

@@ -32,7 +32,7 @@ buildPythonPackage rec {
}; };
preConfigure = with lib.versions; '' preConfigure = with lib.versions; ''
${python.interpreter} configure.py --boost-inc-dir=${boost.dev}/include \ ${python.pythonForBuild.interpreter} configure.py --boost-inc-dir=${boost.dev}/include \
--boost-lib-dir=${boost}/lib \ --boost-lib-dir=${boost}/lib \
--no-use-shipped-boost \ --no-use-shipped-boost \
--boost-python-libname=boost_python${major python.version}${minor python.version} \ --boost-python-libname=boost_python${major python.version}${minor python.version} \

View File

@@ -52,7 +52,7 @@ buildPythonPackage rec {
]; ];
preConfigure = '' preConfigure = ''
${python.interpreter} buildconfig/config.py ${python.pythonForBuild.interpreter} buildconfig/config.py
''; '';
checkPhase = '' checkPhase = ''

View File

@@ -30,8 +30,8 @@ buildPythonPackage rec {
# for the package to function. Therefore override of buildPhase was # for the package to function. Therefore override of buildPhase was
# necessary. # necessary.
buildPhase = '' buildPhase = ''
${python.interpreter} setup.py build_ext --inplace ${python.pythonForBuild.interpreter} setup.py build_ext --inplace
${python.interpreter} setup.py bdist_wheel ${python.pythonForBuild.interpreter} setup.py bdist_wheel
''; '';
nativeCheckInputs = [ nativeCheckInputs = [
@@ -50,4 +50,3 @@ buildPythonPackage rec {
maintainers = with maintainers; [ nialov ]; maintainers = with maintainers; [ nialov ];
}; };
} }

View File

@@ -31,7 +31,7 @@ buildPythonPackage rec {
]; ];
preBuild = '' preBuild = ''
${python.interpreter} setup.py build_ext --inplace ${python.pythonForBuild.interpreter} setup.py build_ext --inplace
''; '';
nativeCheckInputs = [ nativeCheckInputs = [

View File

@@ -27,7 +27,7 @@ buildPythonPackage rec {
''} ''}
chmod +x configure.py chmod +x configure.py
sed -i '1i#!${python.interpreter}' configure.py sed -i '1i#!${python.pythonForBuild.interpreter}' configure.py
''; '';
configureScript = "./configure.py"; configureScript = "./configure.py";

View File

@@ -70,7 +70,7 @@ stdenv.mkDerivation rec {
postInstall = '' postInstall = ''
cd ../../.. cd ../../..
${python.interpreter} setup.py egg_info --build-type=pyside2 ${python.pythonForBuild.interpreter} setup.py egg_info --build-type=pyside2
cp -r PySide2.egg-info $out/${python.sitePackages}/ cp -r PySide2.egg-info $out/${python.sitePackages}/
''; '';

View File

@@ -37,8 +37,8 @@ buildPythonPackage rec {
preConfigure = '' preConfigure = ''
cd Source cd Source
${python.interpreter} setup.py backport ${python.pythonForBuild.interpreter} setup.py backport
${python.interpreter} setup.py configure \ ${python.pythonForBuild.interpreter} setup.py configure \
--apr-inc-dir=${apr.dev}/include \ --apr-inc-dir=${apr.dev}/include \
--apu-inc-dir=${aprutil.dev}/include \ --apu-inc-dir=${aprutil.dev}/include \
--pycxx-dir=${pycxx.dev}/include \ --pycxx-dir=${pycxx.dev}/include \

View File

@@ -31,11 +31,11 @@ buildPythonPackage rec {
''; '';
preBuild = '' preBuild = ''
${python.interpreter} setup.py build_ext ${python.pythonForBuild.interpreter} setup.py build_ext
''; '';
installPhase = '' installPhase = ''
${python.interpreter} setup.py install --prefix=$out --single-version-externally-managed ${python.pythonForBuild.interpreter} setup.py install --prefix=$out --single-version-externally-managed
''; '';
doCheck = false; doCheck = false;

View File

@@ -17,7 +17,7 @@ in buildPythonPackage rec {
nativeBuildInputs = [ cython ]; nativeBuildInputs = [ cython ];
preBuild = '' preBuild = ''
${python.interpreter} setup.py build_ext -i ${python.pythonForBuild.interpreter} setup.py build_ext -i
''; '';
checkPhase = '' checkPhase = ''

View File

@@ -24,7 +24,7 @@ buildPythonPackage rec {
nativeCheckInputs = [ pytestCheckHook ]; nativeCheckInputs = [ pytestCheckHook ];
postBuild = '' postBuild = ''
${python.interpreter} pywayland/ffi_build.py ${python.pythonForBuild.interpreter} pywayland/ffi_build.py
''; '';
# Tests need this to create sockets # Tests need this to create sockets

View File

@@ -36,7 +36,7 @@ buildPythonPackage rec {
nativeCheckInputs = [ pytestCheckHook ]; nativeCheckInputs = [ pytestCheckHook ];
postBuild = '' postBuild = ''
${python.interpreter} wlroots/ffi_build.py ${python.pythonForBuild.interpreter} wlroots/ffi_build.py
''; '';
pythonImportsCheck = [ "wlroots" ]; pythonImportsCheck = [ "wlroots" ];

View File

@@ -45,7 +45,7 @@ stdenv.mkDerivation {
postInstall = '' postInstall = ''
cd ../../.. cd ../../..
${python.interpreter} setup.py egg_info --build-type=shiboken2 ${python.pythonForBuild.interpreter} setup.py egg_info --build-type=shiboken2
cp -r shiboken2.egg-info $out/${python.sitePackages}/ cp -r shiboken2.egg-info $out/${python.sitePackages}/
rm $out/bin/shiboken_tool.py rm $out/bin/shiboken_tool.py
''; '';

View File

@@ -219,7 +219,7 @@ in buildPythonPackage rec {
preBuild = '' preBuild = ''
export MAX_JOBS=$NIX_BUILD_CORES export MAX_JOBS=$NIX_BUILD_CORES
${python.interpreter} setup.py build --cmake-only ${python.pythonForBuild.interpreter} setup.py build --cmake-only
${cmake}/bin/cmake build ${cmake}/bin/cmake build
''; '';

View File

@@ -69,11 +69,11 @@ buildPythonPackage rec {
''; '';
buildPhase = '' buildPhase = ''
${python.interpreter} build.py -v --use_syswx dox etg --nodoc sip build_py ${python.pythonForBuild.interpreter} build.py -v --use_syswx dox etg --nodoc sip build_py
''; '';
installPhase = '' installPhase = ''
${python.interpreter} setup.py install --skip-build --prefix=$out ${python.pythonForBuild.interpreter} setup.py install --skip-build --prefix=$out
''; '';
passthru = { wxWidgets = wxGTK; }; passthru = { wxWidgets = wxGTK; };

View File

@@ -129,11 +129,11 @@ buildPythonPackage rec {
''; '';
buildPhase = '' buildPhase = ''
${python.interpreter} build.py -v build_wx dox etg --nodoc sip build_py ${python.pythonForBuild.interpreter} build.py -v build_wx dox etg --nodoc sip build_py
''; '';
installPhase = '' installPhase = ''
${python.interpreter} setup.py install --skip-build --prefix=$out ${python.pythonForBuild.interpreter} setup.py install --skip-build --prefix=$out
wrapPythonPrograms wrapPythonPrograms
''; '';

View File

@@ -102,7 +102,7 @@ buildPythonPackage rec {
export PATH="${wxGTK}/bin:$PATH" export PATH="${wxGTK}/bin:$PATH"
export SDL_CONFIG="${SDL.dev}/bin/sdl-config" export SDL_CONFIG="${SDL.dev}/bin/sdl-config"
${python.interpreter} build.py -v --use_syswx dox etg sip --nodoc build_py ${python.pythonForBuild.interpreter} build.py -v --use_syswx dox etg sip --nodoc build_py
runHook postBuild runHook postBuild
''; '';
@@ -111,7 +111,7 @@ buildPythonPackage rec {
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
${python.interpreter} setup.py install --skip-build --prefix=$out ${python.pythonForBuild.interpreter} setup.py install --skip-build --prefix=$out
wrapPythonPrograms wrapPythonPrograms
runHook postInstall runHook postInstall

View File

@@ -26,7 +26,7 @@ buildPythonPackage rec {
doCheck = false; doCheck = false;
postBuild = '' postBuild = ''
${python.interpreter} -m compileall -f xattr ${python.pythonForBuild.interpreter} -m compileall -f xattr
''; '';
pythonImportsCheck = [ pythonImportsCheck = [

View File

@@ -24,7 +24,7 @@ buildPythonPackage rec {
nativeCheckInputs = [ pytestCheckHook ]; nativeCheckInputs = [ pytestCheckHook ];
postBuild = '' postBuild = ''
${python.interpreter} xkbcommon/ffi_build.py ${python.pythonForBuild.interpreter} xkbcommon/ffi_build.py
''; '';
pythonImportsCheck = [ "xkbcommon" ]; pythonImportsCheck = [ "xkbcommon" ];

View File

@@ -21,7 +21,7 @@ python.pkgs.buildPythonApplication rec {
''; '';
preConfigure = '' preConfigure = ''
${python.interpreter} setup.py compile_catalog ${python.pythonForBuild.interpreter} setup.py compile_catalog
''; '';
postInstall = '' postInstall = ''

View File

@@ -29,7 +29,7 @@ stdenv.mkDerivation {
buildPhase = '' buildPhase = ''
export EXTRA_CMAKE_ARGS="-DPATH_TO_LLVM_ROOT=${llvmPackages.libllvm} -DUSE_SYSTEM_ABSEIL=true" export EXTRA_CMAKE_ARGS="-DPATH_TO_LLVM_ROOT=${llvmPackages.libllvm} -DUSE_SYSTEM_ABSEIL=true"
${python.interpreter} build.py --system-libclang --clang-completer --ninja ${python.pythonForBuild.interpreter} build.py --system-libclang --clang-completer --ninja
''; '';
dontConfigure = true; dontConfigure = true;

View File

@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
postBuild = lib.optionalString (pythonSupport) '' postBuild = lib.optionalString (pythonSupport) ''
cd python cd python
${python.interpreter} setup.py install --prefix=../pythonlib ${python.pythonForBuild.interpreter} setup.py install --prefix=../pythonlib
cd - cd -
''; '';

View File

@@ -45,7 +45,7 @@ buildPythonPackage rec {
postInstall = '' postInstall = ''
pushd .. pushd ..
# https://github.com/home-assistant/intents/blob/main/script/package#L18 # https://github.com/home-assistant/intents/blob/main/script/package#L18
${python.interpreter} -m script.intentfest merged_output $out/${python.sitePackages}/home_assistant_intents/data ${python.pythonForBuild.interpreter} -m script.intentfest merged_output $out/${python.sitePackages}/home_assistant_intents/data
popd popd
''; '';

View File

@@ -95,7 +95,7 @@ python.pkgs.buildPythonApplication rec {
# cython modules are not installed for some reasons # cython modules are not installed for some reasons
( (
cd TTS/tts/utils/monotonic_align cd TTS/tts/utils/monotonic_align
${python.interpreter} setup.py install --prefix=$out ${python.pythonForBuild.interpreter} setup.py install --prefix=$out
) )
''; '';

View File

@@ -18,7 +18,7 @@ python3Packages.buildPythonApplication rec {
]; ];
preBuild = '' preBuild = ''
${python3Packages.python.interpreter} ./setup.py build_cython build_ext --inplace ${python3Packages.python.pythonForBuild.interpreter} ./setup.py build_cython build_ext --inplace
''; '';
checkPhase = '' checkPhase = ''