| Total Complexity | 3 | 
| Total Lines | 26 | 
| Duplicated Lines | 0 % | 
| Changes | 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 |