Repository: spack/spack

Issue:
 clingo error on fedora 39 (pre-beta) with Python 3.12.0rc1
### Summary

RFE: Add in support for python-3.12.0rc1

### Rationale

```console
[balay@pj01 spack]$ python --version
Python 3.12.0rc1
[balay@pj01 spack]$ ./bin/spack spec zlib
==> Warning: invalid escape sequence '\$'
==> Warning: invalid escape sequence '\('
==> Fetching https://mirror.spack.io/bootstrap/github-actions/v0.4/build_cache/linux-centos7-x86_64-gcc-10.2.1-patchelf-0.16.1-p72zyan5wrzuabtmzq7isa5mzyh6ahdp.spec.json
==> Fetching https://mirror.spack.io/bootstrap/github-actions/v0.4/build_cache/linux-centos7-x86_64/gcc-10.2.1/patchelf-0.16.1/linux-centos7-x86_64-gcc-10.2.1-patchelf-0.16.1-p72zyan5wrzuabtmzq7isa5mzyh6ahdp.spack
==> Installing "patchelf@=0.16.1%gcc@=10.2.1 ldflags="-static-libstdc++ -static-libgcc"  build_system=autotools arch=linux-centos7-x86_64" from a buildcache
[+] /usr (external cmake-3.27.3-eijgmk25h6lfeub6jxpiwantgk2ogmyy)
==> Installing gmake-4.4.1-7aukyfburpwf4rutyext2qzop5kd4mrm [2/6]
==> No binary for gmake-4.4.1-7aukyfburpwf4rutyext2qzop5kd4mrm found: installing from source
==> Fetching https://mirror.spack.io/_source-cache/archive/dd/dd16fb1d67bfab79a72f5e8390735c49e3e8e70b4945a15ab1f81ddb78658fb3.tar.gz
==> No patches needed for gmake
==> gmake: Executing phase: 'autoreconf'
==> gmake: Executing phase: 'configure'
==> gmake: Executing phase: 'build'
==> gmake: Executing phase: 'install'
==> gmake: Successfully installed gmake-4.4.1-7aukyfburpwf4rutyext2qzop5kd4mrm
  Stage: 0.16s.  Autoreconf: 0.00s.  Configure: 8.83s.  Build: 0.91s.  Install: 0.00s.  Post-install: 0.01s.  Total: 10.00s
[+] /home/balay/.spack/bootstrap/store/linux-fedora39-x86_64/gcc-13.2.1/gmake-4.4.1-7aukyfburpwf4rutyext2qzop5kd4mrm
==> Installing re2c-2.2-3gp7m3xjuuqwbb5ob46oddk2xjinante [3/6]
==> No binary for re2c-2.2-3gp7m3xjuuqwbb5ob46oddk2xjinante found: installing from source
==> Fetching https://mirror.spack.io/_source-cache/archive/0f/0fc45e4130a8a555d68e230d1795de0216dfe99096b61b28e67c86dfd7d86bda.tar.xz
==> No patches needed for re2c
==> re2c: Executing phase: 'configure'
==> re2c: Executing phase: 'build'
==> re2c: Executing phase: 'install'
==> re2c: Successfully installed re2c-2.2-3gp7m3xjuuqwbb5ob46oddk2xjinante
  Stage: 0.22s.  Configure: 6.05s.  Build: 0.99s.  Install: 0.08s.  Post-install: 0.03s.  Total: 7.46s
[+] /home/balay/.spack/bootstrap/store/linux-fedora39-x86_64/gcc-13.2.1/re2c-2.2-3gp7m3xjuuqwbb5ob46oddk2xjinante
[+] /usr (external bison-3.8.2-gmjutlrgjpojmmu4g6kr777zcsjyfcmb)
[+] /usr (external python-3.12-qgbxskt5wvikftucsqoos6p2iukvgd3l)
==> Installing clingo-bootstrap-spack-3untgyct6txoawx7ffddr5hggesi55ll [6/6]
==> No binary for clingo-bootstrap-spack-3untgyct6txoawx7ffddr5hggesi55ll found: installing from source
==> Ran patch() for clingo-bootstrap
==> clingo-bootstrap: Executing phase: 'cmake'
==> clingo-bootstrap: Executing phase: 'build'
==> clingo-bootstrap: Executing phase: 'install'
==> clingo-bootstrap: Successfully installed clingo-bootstrap-spack-3untgyct6txoawx7ffddr5hggesi55ll
  Stage: 6.52s.  Cmake: 1.10s.  Build: 41.36s.  Install: 0.21s.  Post-install: 0.02s.  Total: 49.27s
[+] /home/balay/.spack/bootstrap/store/linux-fedora39-x86_64/gcc-13.2.1/clingo-bootstrap-spack-3untgyct6txoawx7ffddr5hggesi55ll
==> Warning: Spec clingo-bootstrap@=spack%gcc@=13.2.1~docs~ipo~optimized+python~static_libstdcpp build_system=cmake build_type=Release generator=make arch=linux-fedora39-x86_64 ^bison@=3.8.2%gcc@=13.2.1 build_system=autotools arch=linux-fedora39-x86_64 ^cmake@=3.27.3%gcc@=13.2.1~doc+ncurses+ownlibs build_system=generic build_type=Release arch=linux-fedora39-x86_64 ^gmake@=4.4.1%gcc@=13.2.1~guile build_system=autotools arch=linux-fedora39-x86_64 ^python@=3.12%gcc@=13.2.1+bz2+crypt+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic patches=f2fd060 arch=linux-fedora39-x86_64 ^re2c@=2.2%gcc@=13.2.1 build_system=generic arch=linux-fedora39-x86_64 did not provide module clingo
==> Error: expected at least one exception to have been raised at this point: while bootstrapping clingo
```

### Description

_No response_

### Additional information

```console
[balay@pj01 spack]$ ./bin/spack debug report
* **Spack:** 0.21.0.dev0 (deeeb86067fea01262303e2944fc1043a3e82708)
* **Python:** 3.12.0rc1
* **Platform:** linux-fedora39-skylake
* **Concretizer:** clingo
```

Related:
- https://github.com/spack/spack/issues/32559
- https://github.com/spack/spack/issues/29507

### General information

- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:

Resolving patch:
diff --git a/lib/spack/spack/bootstrap/core.py b/lib/spack/spack/bootstrap/core.py
--- a/lib/spack/spack/bootstrap/core.py
+++ b/lib/spack/spack/bootstrap/core.py
@@ -228,7 +228,7 @@ def _install_and_test(
                 if not abstract_spec.intersects(candidate_spec):
                     continue
 
-                if python_spec is not None and python_spec not in abstract_spec:
+                if python_spec is not None and not abstract_spec.intersects(f"^{python_spec}"):
                     continue
 
                 for _, pkg_hash, pkg_sha256 in item["binaries"]:
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -3671,7 +3671,7 @@ def _autospec(self, spec_like):
             return spec_like
         return Spec(spec_like)
 
-    def intersects(self, other: "Spec", deps: bool = True) -> bool:
+    def intersects(self, other: Union[str, "Spec"], deps: bool = True) -> bool:
         """Return True if there exists at least one concrete spec that matches both
         self and other, otherwise False.
 
@@ -3794,7 +3794,7 @@ def _intersects_dependencies(self, other):
 
         return True
 
-    def satisfies(self, other: "Spec", deps: bool = True) -> bool:
+    def satisfies(self, other: Union[str, "Spec"], deps: bool = True) -> bool:
         """Return True if all concrete specs matching self also match other, otherwise False.
 
         Args:


Test patch:
diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml
--- a/.github/workflows/unit_tests.yaml
+++ b/.github/workflows/unit_tests.yaml
@@ -15,7 +15,7 @@ jobs:
     strategy:
       matrix:
         os: [ubuntu-latest]
-        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
+        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
         concretizer: ['clingo']
         on_develop:
         - ${{ github.ref == 'refs/heads/develop' }}
@@ -45,6 +45,10 @@ jobs:
           os: ubuntu-latest
           concretizer: 'clingo'
           on_develop: false
+        - python-version: '3.11'
+          os: ubuntu-latest
+          concretizer: 'clingo'
+          on_develop: false
 
     steps:
     - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # @v2
@@ -185,7 +189,7 @@ jobs:
     runs-on: macos-latest
     strategy:
       matrix:
-        python-version: ["3.10"]
+        python-version: ["3.11"]
     steps:
     - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # @v2
       with:
diff --git a/lib/spack/spack/test/cmd/bootstrap.py b/lib/spack/spack/test/cmd/bootstrap.py
--- a/lib/spack/spack/test/cmd/bootstrap.py
+++ b/lib/spack/spack/test/cmd/bootstrap.py
@@ -169,7 +169,7 @@ def test_remove_and_add_a_source(mutable_config):
     assert not sources
 
     # Add it back and check we restored the initial state
-    _bootstrap("add", "github-actions", "$spack/share/spack/bootstrap/github-actions-v0.3")
+    _bootstrap("add", "github-actions", "$spack/share/spack/bootstrap/github-actions-v0.5")
     sources = spack.bootstrap.core.bootstrapping_sources()
     assert len(sources) == 1
 
diff --git a/lib/spack/spack/test/data/config/bootstrap.yaml b/lib/spack/spack/test/data/config/bootstrap.yaml
--- a/lib/spack/spack/test/data/config/bootstrap.yaml
+++ b/lib/spack/spack/test/data/config/bootstrap.yaml
@@ -1,5 +1,5 @@
 bootstrap:
   sources:
   - name: 'github-actions'
-    metadata: $spack/share/spack/bootstrap/github-actions-v0.3
+    metadata: $spack/share/spack/bootstrap/github-actions-v0.5
   trusted: {}