Skip to content

Commit

Permalink
Ensure symlink points to an existing directory
Browse files Browse the repository at this point in the history
  • Loading branch information
kwankyu committed Mar 31, 2022
1 parent 43474c9 commit 0618873
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/sage_docbuild/ext/multidocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def citation_dir(app: Sphinx) -> Path:
if dirs[0] == '/':
dirs.pop(0)
tail = dirs[1:]
citedir = (sage_doc / "inventory").joinpath(*tail)
citedir = (sage_doc / "inventory").joinpath(*tail)
else:
citedir = outdir / "inventory"
os.makedirs(citedir, exist_ok=True)
Expand Down Expand Up @@ -304,6 +304,10 @@ def copy_static_files(self):
shutil.rmtree(static_dir)
except OSError:
os.unlink(static_dir)
# This ensures that the symlink we are creating points to an
# existing directory. See trac #33608.
os.makedirs(os.path.join(app.builder.outdir, master_static_dir),
exist_ok=True)
os.symlink(master_static_dir, static_dir)

app.builder.copy_static_files = link_static_files
Expand All @@ -314,10 +318,9 @@ def copy_static_files(self):
app.emit('env-check-consistency', app.env)



def setup(app: Sphinx):
app.add_config_value('multidocs_is_master', True, True)
app.add_config_value('multidocs_subdoc_list', [], True)
app.add_config_value('multidoc_first_pass', 0, False) # 1 = deactivate the loading of the inventory
app.connect('builder-inited', init_subdoc)
return {'parallel_read_safe': True}
return {'parallel_read_safe': True}

0 comments on commit 0618873

Please sign in to comment.