spack/var/spack/repos/builtin/packages/clingo
Todd Gamblin 73d25984ca clingo: fix bootstrapping on M1/monterey with command line tools
The Python that comes with XCode command line tools is a bit weird.

This fixes two issues that were preventing it from bootstrapping:

- [x] CommandLineTools python does not come with a `python-config` executable. If you
      don't have one of these, CMake's FindPython will, for some reason, assume that you
      want Python 2, so you need to set `CLINGO_PYTHON_VERSION` to ensure that clingo
      tells `find_package(Python <VERSION>)` the right thing.

- [x] We weren't setting `PYTHONHOME` correctly in Python's `package.py`. We were
      setting it to the `prefix` from Python `sysconfig`, but `prefix` tells you where
      the executable lives. CommandLineTools python reports its prefix as

          /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8

      but that doesn't exist. It looks like Apple builds the full python and just copies
      pieces of it into command line tools. PYTHONHOME is supposed to tell you where the
      default python library location is. So you have to look at the `base`, which
      `sysconfig` reports as

          /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8

      On most systems this is probably the same as `prefix`, but not with
      CommandLineTools, which has its system library in a different place.

The second change here was cherry-picked to 0d981a012d before merging and doesn't show
up here.

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2022-08-17 10:42:15 -07:00
..
package.py clingo: fix bootstrapping on M1/monterey with command line tools 2022-08-17 10:42:15 -07:00
python38.patch