Skip to content

Commit 5eb8a50

Browse files
pipcl.py: swig_get(): fix for macos-graal.
Include brew's bison when checking bison version; avoids the need to build bison on graal, which currently fails.
1 parent 441be45 commit 5eb8a50

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

pipcl.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3348,9 +3348,27 @@ def swig_get(swig, quick, swig_local='pipcl-swig-git'):
33483348
if quick and os.path.isfile(swig_binary):
33493349
log1(f'{quick=} and {swig_binary=} already exists, so not downloading/building.')
33503350
else:
3351+
if darwin():
3352+
run(f'brew install automake')
3353+
run(f'brew install pcre2')
3354+
run(f'brew install bison')
3355+
# Default bison doesn't work, and Brew's bison is not added to $PATH.
3356+
#
3357+
# > bison is keg-only, which means it was not symlinked into /opt/homebrew,
3358+
# > because macOS already provides this software and installing another version in
3359+
# > parallel can cause all kinds of trouble.
3360+
# >
3361+
# > If you need to have bison first in your PATH, run:
3362+
# > echo 'export PATH="/opt/homebrew/opt/bison/bin:$PATH"' >> ~/.zshrc
3363+
#
3364+
swig_env_extra = dict()
3365+
macos_add_brew_path('bison', swig_env_extra)
3366+
run(f'which bison')
3367+
run(f'which bison', env_extra=swig_env_extra)
3368+
33513369
# Building swig requires bison>=3.5.
33523370
bison_ok = 0
3353-
e, text = run(f'bison --version', capture=1, check=0)
3371+
e, text = run(f'bison --version', capture=1, check=0, env_extra=swig_env_extra)
33543372
if not e:
33553373
log(textwrap.indent(text, ' '))
33563374
m = re.search('bison (GNU Bison) ([0-9]+)[.]([0-9]+)', text)
@@ -3398,24 +3416,6 @@ def swig_get(swig, quick, swig_local='pipcl-swig-git'):
33983416
remote='https://github.com/swig/swig.git',
33993417
branch='master',
34003418
)
3401-
if darwin():
3402-
run(f'brew install automake')
3403-
run(f'brew install pcre2')
3404-
run(f'brew install bison')
3405-
# Default bison doesn't work, and Brew's bison is not added to $PATH.
3406-
#
3407-
# > bison is keg-only, which means it was not symlinked into /opt/homebrew,
3408-
# > because macOS already provides this software and installing another version in
3409-
# > parallel can cause all kinds of trouble.
3410-
# >
3411-
# > If you need to have bison first in your PATH, run:
3412-
# > echo 'export PATH="/opt/homebrew/opt/bison/bin:$PATH"' >> ~/.zshrc
3413-
#
3414-
swig_env_extra = dict()
3415-
macos_add_brew_path('bison', swig_env_extra)
3416-
run(f'which bison')
3417-
run(f'which bison', env_extra=swig_env_extra)
3418-
34193419
# Build swig.
34203420
run(f'cd {swig_local} && ./autogen.sh', env_extra=swig_env_extra)
34213421
run(f'cd {swig_local} && ./configure --prefix={swig_local}/install-dir', env_extra=swig_env_extra)

0 commit comments

Comments
 (0)