Call sphinx to build documentation. Attribute `num_jobs` from the class is used. Parameters ---------- kind : {'html', 'latex', 'linkcheck'} Examples -------- >>> DocBuilder(num_jobs=4)._sphinx_build("html")
(self, kind: str)
| 119 | subprocess.check_call(args, stdout=sys.stdout, stderr=sys.stderr) |
| 120 | |
| 121 | def _sphinx_build(self, kind: str): |
| 122 | """ |
| 123 | Call sphinx to build documentation. |
| 124 | |
| 125 | Attribute `num_jobs` from the class is used. |
| 126 | |
| 127 | Parameters |
| 128 | ---------- |
| 129 | kind : {'html', 'latex', 'linkcheck'} |
| 130 | |
| 131 | Examples |
| 132 | -------- |
| 133 | >>> DocBuilder(num_jobs=4)._sphinx_build("html") |
| 134 | """ |
| 135 | if kind not in ("html", "latex", "linkcheck"): |
| 136 | raise ValueError(f"kind must be html, latex or linkcheck, not {kind}") |
| 137 | |
| 138 | cmd = ["sphinx-build", "-b", kind] |
| 139 | if self.num_jobs: |
| 140 | cmd += ["-j", self.num_jobs] |
| 141 | if self.warnings_are_errors: |
| 142 | cmd += ["-W", "--keep-going"] |
| 143 | if self.verbosity: |
| 144 | cmd.append(f"-{'v' * self.verbosity}") |
| 145 | cmd += [ |
| 146 | "-d", |
| 147 | os.path.join(BUILD_PATH, "doctrees"), |
| 148 | SOURCE_PATH, |
| 149 | os.path.join(BUILD_PATH, kind), |
| 150 | ] |
| 151 | return subprocess.call(cmd) |
| 152 | |
| 153 | def _open_browser(self, single_doc_html) -> None: |
| 154 | """ |