File: os_tools.py

package info (click to toggle)
python-ptrace 0.6.4-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 620 kB
  • sloc: python: 6,213; ansic: 241; makefile: 13; sh: 1
file content (29 lines) | stat: -rw-r--r-- 805 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""
Constants about the operating system:

 - RUNNING_PYPY (bool)
 - RUNNING_WINDOWS (bool)
 - RUNNING_LINUX (bool)
 - RUNNING_FREEBSD (bool)
 - RUNNING_OPENBSD (bool)
 - RUNNING_MACOSX (bool)
 - RUNNING_BSD (bool)
 - HAS_PROC (bool)
 - HAS_PTRACE (bool)
"""

from sys import platform, version, version_info

RUNNING_PYTHON3 = version_info[0] == 3
RUNNING_PYPY = ("pypy" in version.lower())
RUNNING_WINDOWS = (platform == 'win32')
RUNNING_LINUX = (platform == 'linux2')
RUNNING_FREEBSD = (platform.startswith('freebsd')
                   or platform.startswith('gnukfreebsd'))
RUNNING_OPENBSD = platform.startswith('openbsd')
RUNNING_MACOSX = (platform == 'darwin')
RUNNING_BSD = RUNNING_FREEBSD or RUNNING_MACOSX or RUNNING_OPENBSD

HAS_PROC = RUNNING_LINUX
HAS_PTRACE = (RUNNING_BSD or RUNNING_LINUX)