diff --git a/python/packaging/classic/setup.py b/python/packaging/classic/setup.py index 8478a60d633b..5e94c2b65380 100755 --- a/python/packaging/classic/setup.py +++ b/python/packaging/classic/setup.py @@ -204,8 +204,13 @@ def run(self): copyfile("pyspark/shell.py", "pyspark/python/pyspark/shell.py") if in_spark: + # !!HACK ALTERT!! + # `setup.py` has to be located with the same directory with the package. + # Therefore, we copy the current file, and place it at `spark/python` directory. + # After that, we remove it in the end. copyfile("packaging/classic/setup.py", "setup.py") copyfile("packaging/classic/setup.cfg", "setup.cfg") + # Construct the symlink farm - this is nein_sparkcessary since we can't refer to # the path above the package root and we need to copy the jars and scripts which # are up above the python root. diff --git a/python/packaging/connect/setup.py b/python/packaging/connect/setup.py index 1ded93fe5693..3cc25faadeab 100755 --- a/python/packaging/connect/setup.py +++ b/python/packaging/connect/setup.py @@ -25,7 +25,7 @@ import sys from setuptools import setup import os -from shutil import copyfile +from shutil import copyfile, move import glob from pathlib import Path @@ -109,6 +109,13 @@ try: if in_spark: + # !!HACK ALTERT!! + # 1. `setup.py` has to be located with the same directory with the package. + # Therefore, we copy the current file, and place it at `spark/python` directory. + # After that, we remove it in the end. + # 2. Here it renames `lib` to `lib.ack` so MANIFEST.in does not pick `py4j` up. + # We rename it back in the end. + move("lib", "lib.back") copyfile("packaging/connect/setup.py", "setup.py") copyfile("packaging/connect/setup.cfg", "setup.cfg") @@ -206,5 +213,6 @@ ) finally: if in_spark: + move("lib.back", "lib") os.remove("setup.py") os.remove("setup.cfg")