Commit a1bd112a authored by Guillaume Seguin's avatar Guillaume Seguin

Support psutil < 2.0

parent 0e4df76f
...@@ -60,13 +60,19 @@ else: ...@@ -60,13 +60,19 @@ else:
try: try:
import psutil import psutil
def set_nice(p, nice):
if callable(p.nice):
p.nice(nice)
else:
p.nice = nice
def set_priority(): def set_priority():
p = psutil.Process() p = psutil.Process()
p.nice(10 if platform.system != "Windows" else psutil.HIGH_PRIORITY_CLASS) set_nice(p, 10 if platform.system != "Windows" else psutil.HIGH_PRIORITY_CLASS)
def reset_priority(): def reset_priority():
p = psutil.Process() p = psutil.Process()
p.nice(0 if platform.system != "Windows" else psutil.NORMAL_PRIORITY_CLASS) set_nice(p, 0 if platform.system != "Windows" else psutil.NORMAL_PRIORITY_CLASS)
def powerset_print_start(reason): def powerset_print_start(reason):
set_priority() set_priority()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment