diff options
author | Todd Gamblin <gamblin2@llnl.gov> | 2021-08-24 21:44:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-24 21:44:26 -0700 |
commit | df10e88e978ea1057401c56e7108dd271ae3151a (patch) | |
tree | 53c0f5c278b7ab2fd12f35e897c5af121be92f7f /pyproject.toml | |
parent | 99076660d45e317cdb5262c65f3446cd23f36bf0 (diff) | |
download | spack-df10e88e978ea1057401c56e7108dd271ae3151a.tar.gz spack-df10e88e978ea1057401c56e7108dd271ae3151a.tar.bz2 spack-df10e88e978ea1057401c56e7108dd271ae3151a.tar.xz spack-df10e88e978ea1057401c56e7108dd271ae3151a.zip |
bootstrap: use `sys.exec_prefix` to set up external python correctly (#25593)
Bootstrapping clingo on macOS on `develop` gives errors like this:
```
==> Error: RuntimeError: Unable to locate python command in /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/bin
/Users/gamblin2/Workspace/spack/var/spack/repos/builtin/packages/python/package.py:662, in command:
659 return Executable(path)
660 else:
661 msg = 'Unable to locate {0} command in {1}'
>> 662 raise RuntimeError(msg.format(self.name, self.prefix.bin))
```
On macOS, `python` is laid out differently. In particular, `sys.executable` is here:
```console
Python 2.7.16 (default, May 8 2021, 11:48:02)
[GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python'
```
Based on that, you'd think that
`/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents` would be
where you'd look for a `bin` directory, but you (and Spack) would be wrong:
```console
$ ls /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/
Info.plist MacOS/ PkgInfo Resources/ _CodeSignature/ version.plist
```
You need to look in `sys.exec_prefix`
```
>>> sys.exec_prefix
'/System/Library/Frameworks/Python.framework/Versions/2.7'
```
Which looks much more like a standard prefix, with understandable `bin`, `lib`, and `include`
directories:
```console
$ ls /System/Library/Frameworks/Python.framework/Versions/2.7
Extras/ Mac/ Resources/ bin/ lib/
Headers@ Python* _CodeSignature/ include/
$ ls -l /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python
lrwxr-xr-x 1 root wheel 7B Jan 1 2020 /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python@ -> python2
```
- [x] change `bootstrap.py` to use the `sys.exec_prefix` as the external prefix, instead of just
getting the parent directory of the executable.
Diffstat (limited to 'pyproject.toml')
0 files changed, 0 insertions, 0 deletions