Skip to content

Commit

Permalink
Add sys.{executable,base_prefix,prefix} to features.pilinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
nulano committed Feb 20, 2024
1 parent 5b20811 commit a6f03a0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
12 changes: 9 additions & 3 deletions Tests/test_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,15 @@ def test_pilinfo() -> None:
while lines[0].startswith(" "):
lines = lines[1:]
assert lines[0] == "-" * 68
assert lines[1].startswith("Python modules loaded from ")
assert lines[2].startswith("Binary modules loaded from ")
assert lines[3] == "-" * 68
assert lines[1].startswith("Python executable is")
lines = lines[2:]
if lines[0].startswith("Environment Python files loaded from"):
lines = lines[1:]
assert lines[0].startswith("System Python files loaded from")
assert lines[1] == "-" * 68
assert lines[2].startswith("Pillow Python modules loaded from ")
assert lines[3].startswith("Pillow binary modules loaded from ")
assert lines[4] == "-" * 68
jpeg = (
"\n"
+ "-" * 68
Expand Down
12 changes: 9 additions & 3 deletions Tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ def test_main() -> None:
while lines[0].startswith(" "):
lines = lines[1:]
assert lines[0] == "-" * 68
assert lines[1].startswith("Python modules loaded from ")
assert lines[2].startswith("Binary modules loaded from ")
assert lines[3] == "-" * 68
assert lines[1].startswith("Python executable is")
lines = lines[2:]
if lines[0].startswith("Environment Python files loaded from"):
lines = lines[1:]
assert lines[0].startswith("System Python files loaded from")
assert lines[1] == "-" * 68
assert lines[2].startswith("Pillow Python modules loaded from ")
assert lines[3].startswith("Pillow binary modules loaded from ")
assert lines[4] == "-" * 68
jpeg = (
os.linesep
+ "-" * 68
Expand Down
9 changes: 7 additions & 2 deletions src/PIL/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,17 @@ def pilinfo(out=None, supported_formats=True):
for py_version in py_version[1:]:
print(f" {py_version.strip()}", file=out)
print("-" * 68, file=out)
print(f"Python executable is {sys.executable or 'unknown'}", file=out)
if sys.prefix != sys.base_prefix:
print(f"Environment Python files loaded from {sys.prefix}", file=out)
print(f"System Python files loaded from {sys.base_prefix}", file=out)
print("-" * 68, file=out)
print(
f"Python modules loaded from {os.path.dirname(Image.__file__)}",
f"Pillow Python modules loaded from {os.path.dirname(Image.__file__)}",
file=out,
)
print(
f"Binary modules loaded from {os.path.dirname(Image.core.__file__)}",
f"Pillow binary modules loaded from {os.path.dirname(Image.core.__file__)}",
file=out,
)
print("-" * 68, file=out)
Expand Down

0 comments on commit a6f03a0

Please sign in to comment.