Files
ElyOffice/packaging/windows/mupdf-parts.py
T
ZacharyZhang-NYandClaude Opus 5.5 76b78782d5 ElyPDF's licences on Windows come from MuPDF's MSBuild projects
mupdf-parts.py reads which third parties and font families the
Windows build compiled in; Make builds still list their folders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 20:00:47 -04:00

27 lines
1.1 KiB
Python

"""Usage: mupdf-parts.py <mupdf-src> parts|fonts; what MSBuild compiled."""
import re
import sys
src, what = sys.argv[1], sys.argv[2]
projects = f"{src}/platform/win32"
# The libraries build-mupdf.sh links into the worker.
built = ["libthirdparty", "libextract", "libharfbuzz", "libleptonica", "libmubarcode",
"libtesseract", "libmupdf", "libpkcs7"]
compiled = re.compile(r'<ClCompile Include="\.\.\\\.\.\\thirdparty\\([^\\"]+)\\')
embedded = re.compile(r'Include="\.\.\\\.\.\\resources\\fonts\\([^\\"]+)\\')
found = set()
if what == "parts":
for name in built:
with open(f"{projects}/{name}.vcxproj", encoding="utf-8") as project:
found |= set(compiled.findall(project.read()))
elif what == "fonts":
with open(f"{projects}/libresources.vcxproj", encoding="utf-8") as project:
found = set(embedded.findall(project.read()))
else:
sys.exit(f"mupdf-parts.py: parts or fonts, not {what}")
if not found:
sys.exit(f"mupdf-parts.py: no {what} in {projects}")
# Bash reads these names; Windows would end them CRLF.
sys.stdout.reconfigure(newline="\n")
print("\n".join(sorted(found)))