Fix user manual rendering for non-existent languages

This commit is contained in:
Kovid Goyal 2021-03-14 20:05:55 +05:30
parent 99f86498c0
commit f034a62ec2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -177,6 +177,8 @@ class Manual(Command):
if not parallel_build(jobs[1:], self.info):
raise SystemExit(1)
cwd = os.getcwd()
with open('resources/localization/website-languages.txt') as wl:
languages = frozenset(filter(None, (x.strip() for x in wl.read().split())))
try:
os.chdir(self.j(tdir, 'en', 'html'))
for x in os.listdir(tdir):
@ -184,7 +186,10 @@ class Manual(Command):
shutil.copytree(self.j(tdir, x, 'html'), x)
self.replace_with_symlinks(x)
else:
os.symlink('..', 'en')
os.symlink('.', 'en')
for x in languages:
if x and not os.path.exists(x):
os.symlink('.', x)
self.info(
'Built manual for %d languages in %s minutes' %
(len(jobs), int((time.time() - st) / 60.))