| 1 |
""" |
| 2 |
Constants about the operating system: |
| 3 |
|
| 4 |
- RUNNING_PYPY (bool) |
| 5 |
- RUNNING_LINUX (bool) |
| 6 |
- RUNNING_FREEBSD (bool) |
| 7 |
- RUNNING_OPENBSD (bool) |
| 8 |
- RUNNING_MACOSX (bool) |
| 9 |
- RUNNING_BSD (bool) |
| 10 |
- HAS_PROC (bool) |
| 11 |
- HAS_PTRACE (bool) |
| 12 |
""" |
| 13 |
|
| 14 |
from sys import platform, version, version_info |
| 15 |
|
| 16 |
RUNNING_PYTHON3 = version_info[0] == 3 |
| 17 |
RUNNING_PYPY = ("pypy" in version.lower()) |
| 18 |
RUNNING_LINUX = platform.startswith('linux') |
| 19 |
RUNNING_FREEBSD = (platform.startswith('freebsd') |
| 20 |
or platform.startswith('gnukfreebsd')) |
| 21 |
RUNNING_OPENBSD = platform.startswith('openbsd') |
| 22 |
RUNNING_MACOSX = (platform == 'darwin') |
| 23 |
RUNNING_BSD = RUNNING_FREEBSD or RUNNING_MACOSX or RUNNING_OPENBSD |
| 24 |
|
| 25 |
HAS_PROC = RUNNING_LINUX |
| 26 |
HAS_PTRACE = (RUNNING_BSD or RUNNING_LINUX) |