Skip to content

Commit b069f97

Browse files
authored
Merge pull request #26 from python-project-templates/tkp/exit
Fail process if issue during build
2 parents ac6c1df + 6ef71ce commit b069f97

5 files changed

Lines changed: 13 additions & 7 deletions

File tree

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ testpaths = "yardang/tests"
123123
[tool.ruff]
124124
line-length = 150
125125

126+
[tool.ruff.lint]
127+
extend-select = ["I"]
128+
126129
[tool.ruff.lint.isort]
127130
combine-as-imports = true
128131
default-section = "third-party"

yardang/build.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import os.path
22
from contextlib import contextmanager
3-
from jinja2 import Environment, FileSystemLoader
43
from pathlib import Path
54
from tempfile import TemporaryDirectory
65
from typing import List, Optional
6+
7+
from jinja2 import Environment, FileSystemLoader
8+
79
from .utils import get_config
810

911
__all__ = ("generate_docs_configuration",)

yardang/cli.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
from sys import executable, stderr, stdout
21
from subprocess import Popen
2+
from sys import executable, stderr, stdout
33
from time import sleep
4-
from typer import Typer
4+
5+
from typer import Exit, Typer
56

67
from .build import generate_docs_configuration
78

@@ -26,6 +27,8 @@ def build(quiet: bool = False, debug: bool = False):
2627
process = Popen(build_cmd, stderr=stderr, stdout=stdout)
2728
while process.poll() is None:
2829
sleep(0.1)
30+
if process.returncode != 0:
31+
raise Exit(process.returncode)
2932

3033

3134
def debug():

yardang/conf.py.j2

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ if use_autoapi in (True, None):
5050
else:
5151
# NOTE: bug in autoapi that requires
5252
# viewcode to come after
53-
extensions.append([
54-
"sphinx.ext.viewcode",
55-
])
53+
extensions.append("sphinx.ext.viewcode")
5654

5755

5856
os.environ["SPHINX_BUILDING"] = "1"

yardang/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
2-
import toml
32
from pathlib import Path
43

4+
import toml
55

66
__all__ = ("get_config",)
77

0 commit comments

Comments
 (0)