Repository: spack/spack

Issue:
Installation issue: clingo@master+python missing py-cffi dependency
### Steps to reproduce the issue

```console
$ spack install clingo@master+python
...
```

Later when trying to use the new ASP-based concretizer, Spack is unable to load `clingo`, as the `cffi` dependency is missing. This was initially reported on Slack. Pinging maintainers @alalazo @tgamblin.

This should be a simple fix:
```python
depends_on('py-cffi', type=('build', 'run'), when='@master+python')
```

### Information on your system

```console
$ spack debug report
* **Spack:** 0.16.1-2354-9dab40dd30
* **Python:** 3.8.5
* **Platform:** linux-centos8-zen2
* **Concretizer:** original
```

### General information

- [x] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [x] I have run `spack maintainers <name-of-the-package>` and @mentioned any maintainers
- [ ] I have uploaded the build log and environment files
- [x] I have searched the issues of this repo and believe this is not a duplicate


Discussion:
@omor1 I'm on it, will submit a PR shortly. With respect to this:

> Later when trying to use the new ASP-based concretizer

If you want to use `clingo` for the new ASP-based solver you can let Spack bootstrap it from sources. For that we use a commit of clingo that is pinned and is known to work for Python 2.6 too. Details are [here](https://spack.readthedocs.io/en/latest/getting_started.html#optional-bootstrapping-clingo). Also, there's this PR waiting for review #22720 which allows bootstrapping from binaries and should be much faster.

EDIT: Another possibility, if you're using Python 3.6 or later to run Spack, is to `pip install clingo` before using Spack. I usually dogfood on Spack but I think this is at least worth mentioning.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/clingo/package.py b/var/spack/repos/builtin/packages/clingo/package.py
--- a/var/spack/repos/builtin/packages/clingo/package.py
+++ b/var/spack/repos/builtin/packages/clingo/package.py
@@ -23,9 +23,11 @@ class Clingo(CMakePackage):
 
     maintainers = ["tgamblin", "alalazo"]
 
-    version('master', branch='master', submodules=True, preferred=True)
+    version('master', branch='master', submodules=True)
     version('spack', commit='2a025667090d71b2c9dce60fe924feb6bde8f667', submodules=True)
 
+    version('5.5.0', sha256='c9d7004a0caec61b636ad1c1960fbf339ef8fdee9719321fc1b6b210613a8499')
+    version('5.4.1', sha256='ac6606388abfe2482167ce8fd4eb0737ef6abeeb35a9d3ac3016c6f715bfee02')
     version('5.4.0', sha256='e2de331ee0a6d254193aab5995338a621372517adcf91568092be8ac511c18f3')
     version('5.3.0', sha256='b0d406d2809352caef7fccf69e8864d55e81ee84f4888b0744894977f703f976')
     version('5.2.2', sha256='da1ef8142e75c5a6f23c9403b90d4f40b9f862969ba71e2aaee9a257d058bfcf')
@@ -40,6 +42,13 @@ class Clingo(CMakePackage):
     depends_on('python', type=("build", "link", "run"), when="+python")
     extends('python', when='+python')
 
+    # Clingo 5.5.0 supports Python 3.6 or later and needs CFFI
+    depends_on(
+        'python@3.6.0:',
+        type=('build', 'link', 'run'), when='@5.5.0: +python'
+    )
+    depends_on('py-cffi', type=('build', 'run'), when='@5.5.0: +python')
+
     patch('python38.patch', when="@5.3:5.4")
 
     def patch(self):


Test patch: