summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-02-15 16:36:19 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2020-02-15 16:36:19 +0100
commit09782f20e07741e35eb93db34bd3282b48efaf71 (patch)
tree61e6dc8d15b58d4bcecd0a1ccafdac1cbb15c98f
parenta80ed507440fad5c843e37947566285077886fff (diff)
downloadpsutil-09782f20e07741e35eb93db34bd3282b48efaf71.tar.gz
move stuff around
-rw-r--r--psutil/_common.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/psutil/_common.py b/psutil/_common.py
index 6b9e5074..728d9c62 100644
--- a/psutil/_common.py
+++ b/psutil/_common.py
@@ -759,19 +759,6 @@ else:
def decode(s):
return s
-if bool(os.getenv('PSUTIL_DEBUG', 0)):
- import inspect
-
- def debug(msg):
- """If PSUTIL_DEBUG env var is set, print a debug message to stderr."""
- fname, lineno, func_name, lines, index = inspect.getframeinfo(
- inspect.currentframe().f_back)
- print("psutil-debug [%s:%s]> %s" % (fname, lineno, msg),
- file=sys.stderr)
-else:
- def debug(msg):
- pass
-
# =====================================================================
# --- shell utils
@@ -843,3 +830,17 @@ def print_color(s, color="green", bold=False, file=sys.stdout):
print(s, file=file)
finally:
SetConsoleTextAttribute(handle, DEFAULT_COLOR)
+
+
+if bool(os.getenv('PSUTIL_DEBUG', 0)):
+ import inspect
+
+ def debug(msg):
+ """If PSUTIL_DEBUG env var is set, print a debug message to stderr."""
+ fname, lineno, func_name, lines, index = inspect.getframeinfo(
+ inspect.currentframe().f_back)
+ print("psutil-debug [%s:%s]> %s" % (fname, lineno, msg),
+ file=sys.stderr)
+else:
+ def debug(msg):
+ pass