-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warn when files are overwritten in the build directory (#12612)
- Loading branch information
Showing
10 changed files
with
106 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import os | ||
import sys | ||
sys.path.insert(0, os.path.abspath('.')) | ||
|
||
extensions = ['myext'] | ||
html_static_path = ['user_static'] | ||
html_theme = 'basic' |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from pathlib import Path | ||
|
||
from sphinx.util.fileutil import copy_asset | ||
|
||
|
||
def _copy_asset_overwrite_hook(app): | ||
css = app.outdir / '_static' / 'custom-styles.css' | ||
# html_static_path is copied by default | ||
assert css.read_text() == '/* html_static_path */\n' | ||
# warning generated by here | ||
copy_asset( | ||
Path(__file__).parent.joinpath('myext_static', 'custom-styles.css'), | ||
app.outdir / '_static', | ||
) | ||
# This demonstrates the overwriting | ||
assert css.read_text() == '/* extension styles */\n' | ||
return [] | ||
|
||
|
||
def setup(app): | ||
app.connect('html-collect-pages', _copy_asset_overwrite_hook) | ||
app.add_css_file('custom-styles.css') |
1 change: 1 addition & 0 deletions
1
tests/roots/test-util-copyasset_overwrite/myext_static/custom-styles.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* extension styles */ |
1 change: 1 addition & 0 deletions
1
tests/roots/test-util-copyasset_overwrite/user_static/custom-styles.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* html_static_path */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters