1
0
Fork 0
mirror of https://git.freebsd.org/ports.git synced 2025-06-20 12:10:31 -04:00
ports/devel/doxygen/files/patch-doc-translator.py
Dima Panov b8ac15afd0 devel/doxygen: update to 1.9.1 release
Also regen 'pkg-plist' for affected consumers, with PORTREVISION bump
Touch Mk/bsd.ruby.mk due to all ruby* is affected
MFH:	2021Q2
2021-04-18 20:02:20 +10:00

23 lines
996 B
Python

Hack to avoid "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 45: invalid start byte"
in src/._xmlgen.cpp which is binary. This doesn't seem like it should be present at the time the docs
are generated, but this is simpler for now.
--- doc/translator.py
+++ doc/translator.py
@@ -1454,10 +1454,13 @@ class TrManager:
# Read content of the file as one string.
assert os.path.isfile(fname)
- f = xopen(fname)
- cont = f.read()
- cont = ''.join(cont.split('\n')) # otherwise the 'match' function won't work.
- f.close()
+ try:
+ with xopen(fname) as f:
+ cont = f.read()
+ cont = ''.join(cont.split('\n')) # otherwise the 'match' function won't work.
+ except UnicodeDecodeError:
+ print("Skipping {0} because of decoding errors".format(fname))
+ return
# Remove the items for identifiers that were found in the file.
while lst_in: