mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-14 19:07:41 +01:00
a2cb35d4c5
* fix(social): CairoSVG OSError handling in social plugin Related issue: #6817 Co-authored-by: Guts <1596222+Guts@users.noreply.github.com> * feat(docs): Add troubleshooting guide for CairoSVG crash --------- Co-authored-by: Kamil Krzyśków <kamilzary@gmail.com> Co-authored-by: Guts <1596222+Guts@users.noreply.github.com> Co-authored-by: Martin Donath <martin.donath@squidfunk.com>
32 lines
884 B
Python
32 lines
884 B
Python
import os
|
|
|
|
library_names = ("cairo-2", "cairo", "libcairo-2")
|
|
filenames = ("libcairo.so.2", "libcairo.2.dylib", "libcairo-2.dll")
|
|
first_found = ""
|
|
names = []
|
|
|
|
for name in library_names:
|
|
if name.lower().endswith(".dll"):
|
|
names += [name]
|
|
else:
|
|
names += [name, name + ".dll"]
|
|
|
|
for name in names:
|
|
for path in os.environ["PATH"].split(os.pathsep):
|
|
resolved_path = os.path.join(path, name)
|
|
if os.path.exists(resolved_path):
|
|
print(f"Found: {resolved_path}")
|
|
if not first_found:
|
|
first_found = resolved_path
|
|
continue
|
|
print(f"Doesn't exist: {resolved_path}")
|
|
print("---")
|
|
|
|
if first_found:
|
|
filenames = (first_found,) + filenames
|
|
|
|
print(f"The path is {first_found or 'not found'}")
|
|
print("List of files that FFI will try to load:")
|
|
for filename in filenames:
|
|
print("-", filename)
|