diff options
author | scoder <stefan_ml@behnel.de> | 2023-05-04 09:29:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-04 09:29:53 +0200 |
commit | 442c8f48d3146ec32c7d5387310e171276cf10ac (patch) | |
tree | d8911d1a64e384b7955d3fc09a07edd218a9f1ee /numpy/_build_utils/gcc_build_bitness.py | |
parent | 3e4a6cba2da27bbe2a6e12c163238e503c9f6a07 (diff) | |
parent | 9163e933df91b516b6f0c7a9ba8ad1750e642f37 (diff) | |
download | numpy-442c8f48d3146ec32c7d5387310e171276cf10ac.tar.gz |
Merge branch 'main' into cython3_noexcept
Diffstat (limited to 'numpy/_build_utils/gcc_build_bitness.py')
-rw-r--r-- | numpy/_build_utils/gcc_build_bitness.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/numpy/_build_utils/gcc_build_bitness.py b/numpy/_build_utils/gcc_build_bitness.py new file mode 100644 index 000000000..fcad237e9 --- /dev/null +++ b/numpy/_build_utils/gcc_build_bitness.py @@ -0,0 +1,21 @@ +#!python +""" Detect bitness (32 or 64) of Mingw-w64 gcc build target on Windows. +""" + +import re +from subprocess import run, PIPE + + +def main(): + res = run(['gcc', '-v'], check=True, text=True, capture_output=True) + target = re.search(r'^Target: (.*)$', res.stderr, flags=re.M).groups()[0] + if target.startswith('i686'): + print('32') + elif target.startswith('x86_64'): + print('64') + else: + raise RuntimeError('Could not detect Mingw-w64 bitness') + + +if __name__ == "__main__": + main() |