|
2 | 2 | # The .NET Foundation licenses this file to you under the Apache 2.0 License. |
3 | 3 | # See the LICENSE file in the project root for more information. |
4 | 4 |
|
5 | | -import sys, os |
6 | | -#from iptest.util import get_env_var, get_temp_dir |
| 5 | +import os |
| 6 | +import sys |
7 | 7 |
|
8 | 8 | #------------------------------------------------------------------------------ |
9 | 9 |
|
10 | 10 | #--IronPython or something else? |
11 | | -is_cli = sys.implementation.name == 'ironpython' |
| 11 | +is_cli = sys.implementation.name == 'ironpython' |
12 | 12 | is_ironpython = is_cli |
13 | | -is_cpython = not is_ironpython |
| 13 | +is_cpython = sys.implementation.name == 'cpython' |
14 | 14 | is_windows = sys.platform == 'win32' |
15 | | -is_posix = sys.platform == 'posix' or sys.platform == 'linux' |
| 15 | +is_linux = sys.platform == 'linux' |
16 | 16 | is_osx = sys.platform == 'darwin' |
| 17 | +is_posix = is_linux or is_osx |
| 18 | + |
17 | 19 | is_netcoreapp = False |
18 | 20 | is_netcoreapp21 = False |
19 | 21 | is_netcoreapp30 = False |
20 | 22 | is_mono = False |
21 | | - |
22 | 23 | if is_ironpython: |
23 | | - #We'll use System, if available, to figure out more info on the test |
24 | | - #environment later |
25 | | - import System |
26 | 24 | import clr |
27 | 25 | is_netcoreapp = clr.IsNetCoreApp |
28 | 26 | is_netcoreapp21 = clr.TargetFramework == ".NETCoreApp,Version=v2.1" |
29 | 27 | is_netcoreapp30 = clr.TargetFramework == ".NETCoreApp,Version=v3.0" |
30 | | - if is_netcoreapp: clr.AddReference("System.Runtime.Extensions") |
31 | | - is_posix = sys.platform == 'posix' or System.Environment.OSVersion.Platform == System.PlatformID.Unix |
32 | | - is_osx = os.path.exists('/System/Library/CoreServices/SystemVersion.plist') |
33 | 28 | is_mono = clr.IsMono |
34 | 29 |
|
35 | 30 | #--The bittedness of the Python implementation |
36 | 31 | is_cli32, is_cli64 = False, False |
37 | 32 | if is_ironpython: |
| 33 | + import System |
38 | 34 | is_cli32, is_cli64 = (System.IntPtr.Size == 4), (System.IntPtr.Size == 8) |
39 | 35 |
|
40 | 36 | is_32, is_64 = is_cli32, is_cli64 |
|
50 | 46 | is_net45Or46 = False |
51 | 47 | is_net46 = False |
52 | 48 | if is_cli: |
| 49 | + if is_netcoreapp: clr.AddReference("System.Runtime.Extensions") |
53 | 50 | version = System.Environment.Version |
54 | 51 | is_net40 = version.Major == 4 |
55 | 52 | is_net45 = is_net40 and version.Minor == 0 and version.Build == 30319 and version.Revision < 42000 |
|
60 | 57 | if is_ironpython: |
61 | 58 | newline = System.Environment.NewLine |
62 | 59 | else: |
63 | | - import os |
64 | 60 | newline = os.linesep |
65 | 61 |
|
66 | 62 | #--Build flavor of Python being tested |
|
0 commit comments