pythonPackages.pyspark: fix calling wrapped python script

See NixOS#64358 for the details.
This commit is contained in:
Sergey Volkov 2024-06-27 08:46:08 +02:00
parent 5084cadd15
commit 9f50cb7e55

View File

@ -29,6 +29,17 @@ buildPythonPackage rec {
--replace py4j== 'py4j>='
'';
postFixup = ''
# find_python_home.py has been wrapped as a shell script
substituteInPlace $out/bin/find-spark-home \
--replace 'export SPARK_HOME=$($PYSPARK_DRIVER_PYTHON "$FIND_SPARK_HOME_PYTHON_SCRIPT")' \
'export SPARK_HOME=$("$FIND_SPARK_HOME_PYTHON_SCRIPT")'
# patch PYTHONPATH in pyspark so that it properly looks at SPARK_HOME
substituteInPlace $out/bin/pyspark \
--replace 'export PYTHONPATH="''${SPARK_HOME}/python/:$PYTHONPATH"' \
'export PYTHONPATH="''${SPARK_HOME}/..:''${SPARK_HOME}/python/:$PYTHONPATH"'
'';
propagatedBuildInputs = [ py4j ];
passthru.optional-dependencies = {