Skip to content

Commit 69d2487

Browse files
GH-47321: [CI][Dev] Fix shellcheck errors in the ci/scripts/python_sdist_test.sh (#47322)
### Rationale for this change This is the sub issue #44748. * SC1091: Not following * SC2012: Use `find` instead of `ls` to better handle non-alphanumeric filenames. * SC2086: Double quote to prevent globbing and word splitting ``` heck ci/scripts/python_sdist_test.sh In ci/scripts/python_sdist_test.sh line 56: sdist=$(ls ${arrow_dir}/python/dist/pyarrow-*.tar.gz | sort -r | head -n1) ^-- SC2012 (info): Use find instead of ls to better handle non-alphanumeric filenames. ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: sdist=$(ls "${arrow_dir}"/python/dist/pyarrow-*.tar.gz | sort -r | head -n1) In ci/scripts/python_sdist_test.sh line 60: . "${ARROW_PYTHON_VENV}/bin/activate" ^-- SC1091 (info): Not following: ./bin/activate: openBinaryFile: does not exist (No such file or directory) In ci/scripts/python_sdist_test.sh line 63: ${PYTHON:-python} -m pip install ${sdist} ^------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ${PYTHON:-python} -m pip install "${sdist}" In ci/scripts/python_sdist_test.sh line 65: pytest -r s ${PYTEST_ARGS:-} --pyargs pyarrow ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: pytest -r s "${PYTEST_ARGS:-}" --pyargs pyarrow For more information: https://www.shellcheck.net/wiki/SC1091 -- Not following: ./bin/activate: op... https://www.shellcheck.net/wiki/SC2012 -- Use find instead of ls to better ... https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ... ``` ### What changes are included in this PR? * SC1091: Skip file check * SC2012: Use `find` instead of `ls` command * SC2086: Quote variables ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #47321 Authored-by: Hiroyuki Sato <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
1 parent 71a7b55 commit 69d2487

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ repos:
341341
?^ci/scripts/python_build_emscripten\.sh$|
342342
?^ci/scripts/python_build\.sh$|
343343
?^ci/scripts/python_sdist_build\.sh$|
344+
?^ci/scripts/python_sdist_test\.sh$|
344345
?^ci/scripts/python_wheel_unix_test\.sh$|
345346
?^ci/scripts/r_build\.sh$|
346347
?^ci/scripts/r_revdepcheck\.sh$|

ci/scripts/python_sdist_test.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,17 @@ fi
5353
if [ -n "${PYARROW_VERSION:-}" ]; then
5454
sdist="${arrow_dir}/python/dist/pyarrow-${PYARROW_VERSION}.tar.gz"
5555
else
56-
sdist=$(ls ${arrow_dir}/python/dist/pyarrow-*.tar.gz | sort -r | head -n1)
56+
sdist=$(echo "${arrow_dir}"/python/dist/pyarrow-*.tar.gz | sort -r | head -n1)
5757
fi
5858

5959
if [ -n "${ARROW_PYTHON_VENV:-}" ]; then
60+
# We don't need to follow this external file.
61+
# See also: https://www.shellcheck.net/wiki/SC1091
62+
#
63+
# shellcheck source=/dev/null
6064
. "${ARROW_PYTHON_VENV}/bin/activate"
6165
fi
6266

63-
${PYTHON:-python} -m pip install ${sdist}
67+
${PYTHON:-python} -m pip install "${sdist}"
6468

65-
pytest -r s ${PYTEST_ARGS:-} --pyargs pyarrow
69+
pytest -r s "${PYTEST_ARGS:-}" --pyargs pyarrow

0 commit comments

Comments
 (0)