apexpy._gcc_build_bitness   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 14
dl 0
loc 26
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A main() 0 10 3
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