Skip to content

Commit

Permalink
Fixes #6759: validation of html static paths and extra paths no longe…
Browse files Browse the repository at this point in the history
…r throws an error if the paths are in different directories
  • Loading branch information
Nate Damon authored and tk0miya committed Oct 26, 2019
1 parent f30e2af commit c6bd00d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Other contributors, listed alphabetically, are:
* Henrique Bastos -- SVG support for graphviz extension
* Daniel Bültmann -- todo extension
* Marco Buttu -- doctest extension (pyversion option)
* Nathan Damon -- bugfix in validation of static paths in html builders
* Etienne Desautels -- apidoc module
* Michael Droettboom -- inheritance_diagram extension
* Charles Duffy -- original graphviz extension
Expand Down
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Bugs fixed

* #6641: LaTeX: Undefined control sequence ``\sphinxmaketitle``
* #6710: LaTeX not well configured for Greek language as main language
* #6759: validation of html static paths and extra paths no longer throws an error if the paths are in different directories

Testing
--------
Expand Down
22 changes: 16 additions & 6 deletions sphinx/builders/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,9 +1162,14 @@ def validate_html_extra_path(app: Sphinx, config: Config) -> None:
if not path.exists(extra_path):
logger.warning(__('html_extra_path entry %r does not exist'), entry)
config.html_extra_path.remove(entry)
elif path.commonpath([app.outdir, extra_path]) == app.outdir:
logger.warning(__('html_extra_path entry %r is placed inside outdir'), entry)
config.html_extra_path.remove(entry)
else:
try:
common_path = path.commonpath([app.outdir, extra_path])
except ValueError: # different directories, can skip to next
continue
if common_path == app.outdir:
logger.warning(__('html_extra_path entry %r is placed inside outdir'), entry)
config.html_extra_path.remove(entry)


def validate_html_static_path(app: Sphinx, config: Config) -> None:
Expand All @@ -1174,9 +1179,14 @@ def validate_html_static_path(app: Sphinx, config: Config) -> None:
if not path.exists(static_path):
logger.warning(__('html_static_path entry %r does not exist'), entry)
config.html_static_path.remove(entry)
elif path.commonpath([app.outdir, static_path]) == app.outdir:
logger.warning(__('html_static_path entry %r is placed inside outdir'), entry)
config.html_static_path.remove(entry)
else:
try:
common_path = path.commonpath([app.outdir, static_path])
except ValueError: # different directories, can skip to next
continue
if common_path == app.outdir:
logger.warning(__('html_static_path entry %r is placed inside outdir'), entry)
config.html_static_path.remove(entry)


def validate_html_logo(app: Sphinx, config: Config) -> None:
Expand Down

0 comments on commit c6bd00d

Please sign in to comment.