Skip to content

Commit

Permalink
workaround for setup script on windows with older python
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cortes committed Mar 19, 2023
1 parent cc1e2e4 commit 70552b4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ def set_omp_false():
or ("-verbose" in sys.argv)
or ("--verbose" in sys.argv))

## Workaround for python<=3.9 on windows
try:
EXIT_SUCCESS = os.EX_OK
except AttributeError:
EXIT_SUCCESS = 0

class build_ext_subclass( build_ext_with_blas ):
def build_extensions(self):
Expand Down Expand Up @@ -198,7 +203,7 @@ def add_openmp_linkage(self):
has_brew_omp = False
if is_apple:
res_brew_pref = subprocess.run(["brew", "--prefix", "libomp"], capture_output=silent_tests)
if res_brew_pref.returncode == os.EX_OK:
if res_brew_pref.returncode == EXIT_SUCCESS:
has_brew_omp = True
brew_omp_prefix = res_brew_pref.stdout.decode().strip()
args_apple_omp3 = ["-Xclang", "-fopenmp", f"-L{brew_omp_prefix}/lib", "-lomp", f"-I{brew_omp_prefix}/include"]
Expand Down Expand Up @@ -260,7 +265,7 @@ def test_supports_compile_arg(self, comm, with_omp=False):
ftest.write(u"#include <omp.h>\nint main(int argc, char**argv) {return 0;}\n")
try:
val = subprocess.run(cmd + comm + [fname], capture_output=silent_tests).returncode
is_supported = (val == os.EX_OK)
is_supported = (val == EXIT_SUCCESS)
except Exception:
is_supported = False
except Exception:
Expand Down Expand Up @@ -309,7 +314,7 @@ def test_supports_clang_reassociate(self):
""")
try:
val = subprocess.run(cmd + [fname], capture_output=silent_tests).returncode
is_supported = (val == os.EX_OK)
is_supported = (val == EXIT_SUCCESS)
except Exception:
is_supported = False
except Exception:
Expand Down

0 comments on commit 70552b4

Please sign in to comment.