Robot Framework Integrated Development Environment (RIDE)
platform.py
Go to the documentation of this file.
1 # Copyright 2008-2015 Nokia Networks
2 # Copyright 2016- Robot Framework Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 import os
17 import re
18 import sys
19 
20 
21 java_match = re.match(r'java(\d+)\.(\d+)\.(\d+)', sys.platform)
22 if java_match:
23  JYTHON = True
24  JAVA_VERSION = tuple(int(i) for i in java_match.groups())
25 else:
26  JYTHON = False
27  JAVA_VERSION = (0, 0, 0)
28 PY_VERSION = sys.version_info[:3]
29 PY2 = PY_VERSION[0] == 2
30 PY3 = not PY2
31 IRONPYTHON = sys.platform == 'cli'
32 PYPY = 'PyPy' in sys.version
33 UNIXY = os.sep == '/'
34 WINDOWS = not UNIXY
35 
36 RERAISED_EXCEPTIONS = (KeyboardInterrupt, SystemExit, MemoryError)
37 if JYTHON:
38  from java.lang import OutOfMemoryError
39  RERAISED_EXCEPTIONS += (OutOfMemoryError,)