From a71f3d1cecd75c84d0f163329a68d17aefaaf357 Mon Sep 17 00:00:00 2001 From: isobelhooper Date: Thu, 7 Nov 2024 14:16:14 +0000 Subject: [PATCH] Handle case in _configure_openmp() where MacOS system doesn't have Homebrew On a MacOS system that's not using Homebrew, running `brew --prefix llvm` with `subprocess.check_output` doesn't produce a CalledProcessError; instead, when the shell produces a FileNotFoundError it passes it back and `check_output` raises that instead. If we check for OSError (the parent of FileNotFoundError, which should handle other OS-related errors that could get passed back) as well, then this should correctly handle this case. The MacPorts check doesn't have the same issue, because the `which` command is built in and so `which port` will raise a CalledProcessError if MacPorts isn't installed. --- CHANGELOG.md | 1 + setup.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e58e1202..7bca384b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed some typos (thanks to @eltociear, @Darkdragon84) - Fixed support for Python 3.12 +- Fixed check for OpenMP so it works on MacOS systems without Homebrew ### Removed diff --git a/setup.py b/setup.py index 24a647bd..3cc138a0 100755 --- a/setup.py +++ b/setup.py @@ -505,7 +505,7 @@ def _configure_openmp(self): self.opts.append(flag) self.link_opts.extend((l_arg, flag)) return - except subprocess.CalledProcessError: + except (subprocess.CalledProcessError, OSError): pass try: