diff --git a/dev/make-distribution.sh b/dev/make-distribution.sh index e43e4afbd0e2..7cd9ea7889e8 100755 --- a/dev/make-distribution.sh +++ b/dev/make-distribution.sh @@ -294,7 +294,11 @@ mkdir "$DISTDIR/conf" cp "$SPARK_HOME"/conf/*.template "$DISTDIR/conf" cp "$SPARK_HOME/README.md" "$DISTDIR" cp -r "$SPARK_HOME/bin" "$DISTDIR" -cp -r "$SPARK_HOME/python" "$DISTDIR" +if command -v git && command -v cpio && git rev-parse --git-dir 2>/dev/null; then + git ls-files -z "$SPARK_HOME/python" | cpio -0pdm "$DISTDIR" +else + cp -r "$SPARK_HOME/python" "$DISTDIR" +fi # Remove the python distribution from dist/ if we built it if [ "$MAKE_PIP" == "true" ]; then