Merge pull request #322826 from taranarmo/pyspark-fix-find-spark-home-script

pythonPackages.pyspark: fix calling wrapped python script
This commit is contained in:
Jörg Thalheim 2024-07-08 09:44:07 +02:00 committed by GitHub
commit 6edd5cc7bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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 = {