Skip to content

Commit

Permalink
[FIX] Fix import syntax to enable shutil.which check
Browse files Browse the repository at this point in the history
In PR 1585 a syntax error was introduced  as `shutil.which` is a method of the Python
'shutil' module and not a module, so the proper import is `from shutil import which`
as regardless of the CPython version `import shutil.which` will result in a

ModuleNotFoundError: No module named 'shutil.which'; 'shutil' is not a package

This error was causing all runs of packaging/wheel/install.sh to use the legacy behavior
of `python setup.py install` regardless if `shutil.which` was available or not.
  • Loading branch information
matthewfeickert committed Apr 26, 2022
1 parent 991fcb6 commit 1c885e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packaging/wheel/install.sh
Expand Up @@ -40,7 +40,7 @@ fi
cd ../bindings/python

# Determine if shutil.which is available for a modern Python package install
${6} -c 'import shutil.which' &> /dev/null # $6 holds the python sys.executable
${6} -c 'from shutil import which' &> /dev/null # $6 holds the python sys.executable
shutil_which_available=$?
if [ "${shutil_which_available}" -ne "0" ]; then
${6} setup.py install ${3}
Expand Down

0 comments on commit 1c885e0

Please sign in to comment.