Skip to content

Commit

Permalink
ARROW-12619: [Python] pyarrow sdist should not require git
Browse files Browse the repository at this point in the history
There is a fallback_version configuration option for setuptools_scm which we don't use: https://github.com/pypa/setuptools_scm#configuration-parameters

Although this setting seems to have issues according to pypa/setuptools_scm#549
We already have a workaround in setup.py for the functionality of the fallback_version option, but it is disabled for the case of sdist: https://github.com/apache/arrow/blob/master/python/setup.py#L529

Closes #10342 from kszucs/ARROW-12619

Authored-by: Krisztián Szűcs <szucs.krisztian@gmail.com>
Signed-off-by: Krisztián Szűcs <szucs.krisztian@gmail.com>
  • Loading branch information
kszucs committed May 17, 2021
1 parent 577863f commit 63da155
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 7 additions & 1 deletion ci/scripts/python_sdist_test.sh
Expand Up @@ -42,10 +42,16 @@ export PYARROW_WITH_DATASET=${ARROW_DATASET:-OFF}
# unset ARROW_HOME
# apt purge -y pkg-config

# ARROW-12619
if command -v git &> /dev/null; then
echo "Git exists, remove it from PATH before executing this script."
exit 1
fi

if [ -n "${PYARROW_VERSION:-}" ]; then
sdist="${arrow_dir}/python/dist/pyarrow-${PYARROW_VERSION}.tar.gz"
else
sdist=$(ls "${arrow_dir}/python/dist/pyarrow-*.tar.gz" | sort -r | head -n1)
sdist=$(ls ${arrow_dir}/python/dist/pyarrow-*.tar.gz | sort -r | head -n1)
fi
${PYTHON:-python} -m pip install ${sdist}

Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Expand Up @@ -712,6 +712,7 @@ services:
volumes: *ubuntu-volumes
command: >
/bin/bash -c "
apt remove -y git &&
/arrow/ci/scripts/cpp_build.sh /arrow /build &&
/arrow/ci/scripts/python_sdist_test.sh /arrow"
Expand Down
8 changes: 2 additions & 6 deletions python/setup.py
Expand Up @@ -522,12 +522,8 @@ def _move_shared_libs_unix(build_prefix, build_lib, lib_name):
default_version = '4.0.0'
if (not os.path.exists('../.git') and
not os.environ.get('SETUPTOOLS_SCM_PRETEND_VERSION')):
if os.path.exists('PKG-INFO'):
# We're probably in a Python sdist, setuptools_scm will handle fine
pass
else:
os.environ['SETUPTOOLS_SCM_PRETEND_VERSION'] = \
default_version.replace('-SNAPSHOT', 'a0')
os.environ['SETUPTOOLS_SCM_PRETEND_VERSION'] = \
default_version.replace('-SNAPSHOT', 'a0')


# See https://github.com/pypa/setuptools_scm#configuration-parameters
Expand Down

0 comments on commit 63da155

Please sign in to comment.