|
15 | 15 | import subprocess |
16 | 16 | import textwrap |
17 | 17 |
|
18 | | -try: |
19 | | - # Mimic what cling does to find standard headers include path |
20 | | - cmd = shlex.split('c++ -xc++ -E -v /dev/null') |
21 | | - env = os.environ |
22 | | - env.update({'LC_ALL': 'C'}) |
23 | | - subprocess.run(cmd, env=env, check=True, |
24 | | - stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) |
25 | | -except Exception as e: |
26 | | - msg = ( |
27 | | - "Could not find a C++ compiler when importing ROOT. Make sure a C++ compiler as well as the C++ standard " |
28 | | - "libraries are installed. For example, run `[apt,dnf] install g++` or follow similar instructions for your " |
29 | | - "distribution. For more info, visit https://root.cern/install/dependencies" |
30 | | - ) |
31 | | - raise ImportError(textwrap.fill(msg, width=80)) from e |
| 18 | +import platform |
| 19 | +if platform.system() != "Windows": |
| 20 | + try: |
| 21 | + # Mimic what cling does to find standard headers include path |
| 22 | + cmd = shlex.split('c++ -xc++ -E -v /dev/null') |
| 23 | + env = os.environ |
| 24 | + env.update({'LC_ALL': 'C'}) |
| 25 | + subprocess.run(cmd, env=env, check=True, |
| 26 | + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) |
| 27 | + except Exception as e: |
| 28 | + msg = ( |
| 29 | + "Could not find a C++ compiler when importing ROOT. Make sure a C++ compiler as well as the C++ standard " |
| 30 | + "libraries are installed. For example, run `[apt,dnf] install g++` or follow similar instructions for your " |
| 31 | + "distribution. For more info, visit https://root.cern/install/dependencies" |
| 32 | + ) |
| 33 | + raise ImportError(textwrap.fill(msg, width=80)) from e |
32 | 34 |
|
33 | 35 | # Prevent cppyy's check for the PCH |
34 | 36 | os.environ["CLING_STANDARD_PCH"] = "none" |
|
0 commit comments