@@ -23,31 +23,6 @@ def __init__(
2323 self .post_build_commands = post_build_commands
2424 self .uri = f"http://{ url_host } "
2525
26- def _run_commands (self , commands , log_context ):
27- try :
28- for command in commands :
29- show_message (log_context )
30- show_command (command )
31- subprocess .run (command , check = True )
32- except subprocess .CalledProcessError as e :
33- print (
34- f"{ log_context .title ()} command exited with exit code: { e .returncode } "
35- )
36- print (
37- "Please fix the cause of the error above or press Ctrl+C to stop the "
38- "server."
39- )
40- print (
41- "The server will continue serving the build folder, but the contents "
42- "being served are no longer in sync with the documentation sources. "
43- "Please fix the cause of the error above or press Ctrl+C to stop the "
44- "server."
45- )
46- traceback .print_exception (e )
47- return e .returncode
48- else :
49- return 0
50-
5126 def __call__ (self , * , changed_paths : Sequence [Path ]):
5227 """Generate the documentation using ``sphinx``."""
5328 if changed_paths :
@@ -87,3 +62,28 @@ def __call__(self, *, changed_paths: Sequence[Path]):
8762
8863 # Remind the user of the server URL for convenience.
8964 show_message (f"Serving on { self .uri } " )
65+
66+ def _run_commands (self , commands , log_context ):
67+ try :
68+ for command in commands :
69+ show_message (log_context )
70+ show_command (command )
71+ subprocess .run (command , check = True )
72+ except subprocess .CalledProcessError as e :
73+ print (
74+ f"{ log_context .title ()} command exited with exit code: { e .returncode } "
75+ )
76+ print (
77+ "Please fix the cause of the error above or press Ctrl+C to stop the "
78+ "server."
79+ )
80+ print (
81+ "The server will continue serving the build folder, but the contents "
82+ "being served are no longer in sync with the documentation sources. "
83+ "Please fix the cause of the error above or press Ctrl+C to stop the "
84+ "server."
85+ )
86+ traceback .print_exception (e )
87+ return e .returncode
88+ else :
89+ return 0
0 commit comments