apexpy._gcc_build_bitness.main()   A
last analyzed

Complexity

Conditions 3

Size

Total Lines 10
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 10
rs 9.95
c 0
b 0
f 0
cc 3
nop 0
1
#!python
2
"""Detect bitness (32 or 64) of Mingw-w64 gcc build target on Windows.
3
4
From SciPy v1.10.0.dev0
5
6
"""
7
8
import re
9
from subprocess import run, PIPE
10
11
12
def main():
13
    res = run(['gcc', '-v'], check=True, text=True,
14
              stdout=PIPE, stderr=PIPE)
15
    target = re.search(r'^Target: (.*)$', res.stderr, flags=re.M).groups()[0]
16
    if target.startswith('i686'):
17
        print('32')
18
    elif target.startswith('x86_64'):
19
        print('64')
20
    else:
21
        raise RuntimeError('Could not detect Mingw-w64 bitness')
22
23
24
if __name__ == "__main__":
25
    main()
26