Source code for apexpy._gcc_build_bitness

#!python
"""Detect bitness (32 or 64) of Mingw-w64 gcc build target on Windows.

From SciPy v1.10.0.dev0

"""

import re
from subprocess import run, PIPE


[docs]def main(): res = run(['gcc', '-v'], check=True, text=True, stdout=PIPE, stderr=PIPE) 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()