Skip to content

Commit

Permalink
Reimplemented fix to not rely on error strings'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate Damon authored and tk0miya committed Oct 26, 2019
1 parent b813875 commit 0cfc001
Showing 1 changed file with 8 additions and 20 deletions.
28 changes: 8 additions & 20 deletions sphinx/builders/html.py
Expand Up @@ -1162,16 +1162,10 @@ 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)
else:
try:
common_path = path.commonpath([app.outdir, extra_path])
except ValueError as e: # different directories, can skip to next
if e.args[0] != "Paths don't have the same drive":
raise e
continue
if common_path == app.outdir:
logger.warning(__('html_extra_path entry %r is placed inside outdir'), entry)
config.html_extra_path.remove(entry)
elif (path.splitdrive(app.outdir)[0] == path.splitdrive(extra_path) and
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)


def validate_html_static_path(app: Sphinx, config: Config) -> None:
Expand All @@ -1181,16 +1175,10 @@ 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)
else:
try:
common_path = path.commonpath([app.outdir, static_path])
except ValueError as e: # different directories, can skip to next
if e.args[0] != "Paths don't have the same drive":
raise e
continue
if common_path == app.outdir:
logger.warning(__('html_static_path entry %r is placed inside outdir'), entry)
config.html_static_path.remove(entry)
elif (path.splitdrive(app.outdir)[0] == path.splitdrive(static_path) and
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)


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

0 comments on commit 0cfc001

Please sign in to comment.