Skip to content

Commit 5973cdb

Browse files
committed
make osx build script work with pyenv
1 parent ce07154 commit 5973cdb

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

utils/build-osx.sh

+9-6
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ function create_virtualenv_for_pyinstaller {
1212
# This currently assumes to be run with: Python 3.10.11
1313
# Important: pyinstaller needs a Python binary with shared library files
1414
# With pyenv, for example, you get this like so: env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.10.4
15-
# Use pyenv if available
16-
#if command -v pyenv >/dev/null 2>&1; then
17-
if /bin/false ; then
15+
# Use pyenv if set as environment variable
16+
if [ $USE_PYENV_FOR_SPECTER_BUILD = true ]; then
17+
echo "Trying to use pyenv ..."
18+
if ! command -v pyenv >/dev/null 2>&1; then
19+
echo "Error: pyenv is not available. Please make sure pyenv is installed and configured properly." >&2
20+
exit 1
21+
fi
1822
### This is usually in .zshrc, putting it in .bashrc didn't work ###
19-
###
2023
export PYENV_ROOT="$HOME/.pyenv"
2124
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
2225
eval "$(pyenv init -)"
@@ -26,11 +29,11 @@ function create_virtualenv_for_pyinstaller {
2629
### ------------------------------------------------------------ ###
2730
PYTHON_VERSION=3.10.11
2831
export PYENV_VERSION=$PYTHON_VERSION
29-
echo "pyenv is available. Setting PYENV_VERSION to 3.10.4, using pyenv-virtualenv to create the buildenv..."
32+
echo "Setting PYENV_VERSION to 3.10.11, using pyenv-virtualenv to create the buildenv..."
3033
echo " --> Deleting .buildenv"
3134
pyenv uninstall -f .buildenv
3235
rm -rf "$HOME/.pyenv/versions/$PYTHON_VERSION/envs/.buildenv"
33-
pyenv virtualenv 3.10.4 .buildenv
36+
pyenv virtualenv 3.10.11 .buildenv
3437
pyenv activate .buildenv
3538
else
3639
echo "pyenv is not available. Using system Python version."

0 commit comments

Comments
 (0)