Skip to content

Commit b26844a

Browse files
committed
More documentation in test_compatible_exe.py
1 parent d26b37e commit b26844a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/test_compatible_exe.py

+16
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ def _get_paths(path):
2828
try:
2929
from types import SimpleNamespace
3030
except ImportError:
31+
# Python 2:
3132
from argparse import Namespace as SimpleNamespace
3233

3334

3435
def _run_fallback(args, input=None, **kwargs):
36+
# A port of subprocess.run just enough to run the tests.
3537
process = subprocess.Popen(args, stdin=subprocess.PIPE, **kwargs)
3638
stdout, stderr = process.communicate(input)
3739
retcode = process.wait()
@@ -73,6 +75,20 @@ def print_completed_proc(proc):
7375

7476

7577
def is_dynamically_linked(executable):
78+
"""
79+
Check if Python `executable` is (likely to be) dynamically linked.
80+
81+
It returns three possible values:
82+
83+
* `True`: Likely that it's dynamically linked.
84+
* `False`: Likely that it's statically linked.
85+
* `None`: Unsupported platform.
86+
87+
It's only "likely" since the check is by simple occurrence of a
88+
some substrings like "libpython". For example, if there is
89+
another library existing on the path containing "libpython", this
90+
function may return false-positive.
91+
"""
7692
path = which(executable)
7793
assert os.path.exists(path)
7894
if is_linux and which("ldd"):

0 commit comments

Comments
 (0)