Mercurial > ~astiob > upreckon > hgweb
comparison unix.py @ 85:741ae3391b61
Moved clock/time detection into platform-specific modules and testcases
| author | Oleg Oshmyan <chortos@inbox.lv> |
|---|---|
| date | Thu, 24 Feb 2011 23:59:48 +0000 |
| parents | 06356af50bf9 |
| children | 8cd7a732f2f3 |
comparison
equal
deleted
inserted
replaced
| 84:953a5baa406d | 85:741ae3391b61 |
|---|---|
| 8 import testcases # mutual import | 8 import testcases # mutual import |
| 9 except ImportError: | 9 except ImportError: |
| 10 import __main__ | 10 import __main__ |
| 11 __main__.import_error(sys.exc_info()[1]) | 11 __main__.import_error(sys.exc_info()[1]) |
| 12 | 12 |
| 13 from __main__ import clock | |
| 14 from subprocess import Popen | 13 from subprocess import Popen |
| 15 import os, sys | 14 import os, sys |
| 16 | 15 |
| 17 try: | 16 try: |
| 17 from testcases import clock | |
| 18 except ImportError: | |
| 19 if sys.platform.startswith('java'): | |
| 20 from time import clock | |
| 21 else: | |
| 22 from time import time as clock | |
| 23 | |
| 24 try: | |
| 18 from signal import SIGTERM, SIGKILL | 25 from signal import SIGTERM, SIGKILL |
| 19 except ImportError: | 26 except ImportError: |
| 20 SIGTERM = 15 | 27 SIGTERM = 15 |
| 21 SIGKILL = 9 | 28 SIGKILL = 9 |
| 22 | 29 |
| 23 __all__ = 'call', 'kill', 'terminate', 'pause' | 30 __all__ = 'call', 'kill', 'terminate', 'pause', 'clock' |
| 24 | 31 |
| 25 | 32 |
| 26 if not sys.stdin.isatty(): | 33 if not sys.stdin.isatty(): |
| 27 pause = lambda: sys.stdin.read(1) | 34 pause = lambda: sys.stdin.read(1) |
| 28 catch_escape = False | 35 catch_escape = False |
