diff options
| author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2022-01-09 04:04:31 +0900 |
|---|---|---|
| committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2022-01-09 04:04:31 +0900 |
| commit | ce41a5e3f005dad05f1ddfcca8f94bc77fe12881 (patch) | |
| tree | 0e9bb7c4a1fb9ebb5daa9d3801280575c0c091e2 /sphinx/cmd | |
| parent | 87eda92a52e107e9243acac055037c3d6e50819c (diff) | |
| download | sphinx-git-ce41a5e3f005dad05f1ddfcca8f94bc77fe12881.tar.gz | |
Close #10055: sphinx-build: Create directories when `-w` option given
Diffstat (limited to 'sphinx/cmd')
| -rw-r--r-- | sphinx/cmd/build.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sphinx/cmd/build.py b/sphinx/cmd/build.py index 77e3cd44f..8de24a364 100644 --- a/sphinx/cmd/build.py +++ b/sphinx/cmd/build.py @@ -16,6 +16,7 @@ import os import pdb import sys import traceback +from os import path from typing import IO, Any, List from docutils.utils import SystemMessage @@ -28,6 +29,7 @@ from sphinx.locale import __ from sphinx.util import Tee, format_exception_cut_frames, save_traceback from sphinx.util.console import color_terminal, nocolor, red, terminal_safe # type: ignore from sphinx.util.docutils import docutils_namespace, patch_docutils +from sphinx.util.osutil import abspath, ensuredir def handle_exception(app: Sphinx, args: Any, exception: BaseException, stderr: IO = sys.stderr) -> None: # NOQA @@ -240,6 +242,8 @@ def build_main(argv: List[str] = sys.argv[1:]) -> int: if warning and args.warnfile: try: + warnfile = abspath(args.warnfile) + ensuredir(path.dirname(warnfile)) warnfp = open(args.warnfile, 'w') except Exception as exc: parser.error(__('cannot open warning file %r: %s') % ( |
