summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2017-05-07 14:58:11 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2017-05-07 14:58:11 +0200
commit84a9806a2b82483686ee428afa4fa600981601d2 (patch)
tree37a1b36d1a2fe3bdbcc649998455c0fbd6580fbe
parent86b408d94681c190491b52e57cca1296ccd790c4 (diff)
downloadpsutil-84a9806a2b82483686ee428afa4fa600981601d2.tar.gz
filter shared libs with looking for 'python' in their name
-rw-r--r--psutil/_compat.py3
-rw-r--r--psutil/tests/__init__.py6
2 files changed, 5 insertions, 4 deletions
diff --git a/psutil/_compat.py b/psutil/_compat.py
index 9f2182c2..a318f70f 100644
--- a/psutil/_compat.py
+++ b/psutil/_compat.py
@@ -11,7 +11,7 @@ import os
import sys
__all__ = ["PY3", "long", "xrange", "unicode", "basestring", "u", "b",
- "callable", "lru_cache", "which"]
+ "callable", "lru_cache", "which", "nested"]
PY3 = sys.version_info[0] == 3
@@ -268,7 +268,6 @@ if nested is None:
with B as Y:
with C as Z:
<body>
-
"""
exits = []
vars = []
diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py
index 0de94fd4..97fbfc8f 100644
--- a/psutil/tests/__init__.py
+++ b/psutil/tests/__init__.py
@@ -968,7 +968,8 @@ if POSIX:
ext = ".so"
dst = tempfile.mktemp(prefix=dst_prefix, suffix=ext)
libs = [x.path for x in psutil.Process().memory_maps()
- if os.path.splitext(x.path)[1] == ext]
+ if os.path.splitext(x.path)[1] == ext and
+ 'python' in os.path.basename(x.path)]
src = random.choice(libs)
shutil.copyfile(src, dst)
try:
@@ -990,7 +991,8 @@ else:
dst = tempfile.mktemp(prefix=dst_prefix, suffix=ext)
libs = [x.path for x in psutil.Process().memory_maps()
if os.path.splitext(x.path)[1].lower() == ext and
- 'python' in x.path.lower() and 'wow64' not in x.path.lower()]
+ 'python' in os.path.basebaname(x.path).lower() and
+ 'wow64' not in x.path.lower()]
src = random.choice(libs)
shutil.copyfile(src, dst)
cfile = None