@@ -95,12 +95,48 @@ def get_command(self, name):
9595 error (f"Did you perhaps meant { match !r} ?" )
9696 raise ValueError ()
9797
98+ @classmethod
99+ def create_status_animation (cls , style , msg ):
100+ from threading import Thread , Event
101+ from time import sleep
102+
103+ def status_animation ():
104+ style (msg , end = "" , flush = True )
105+ dot = 1
106+ while True :
107+ if dot > 3 :
108+ style ("\r " + msg + " " * dot + "\b " * dot , end = "" , flush = True )
109+ dot = 1
110+ style ("." , end = "" , flush = True )
111+ dot += 1
112+
113+ if event .is_set ():
114+ style ("\r " + " " * (len (msg ) + dot - 1 ) + "\r " , end = "" )
115+ break
116+ sleep (0.5 )
117+
118+ event = Event ()
119+ t = Thread (daemon = True , target = status_animation )
120+ t .start ()
121+
122+ def finish ():
123+ event .set ()
124+ t .join ()
125+
126+ return finish
127+
98128 @classmethod
99129 def call (cls , cmd , jobname ):
100130 import subprocess
131+
132+ stop_animation = cls .create_status_animation (print , f"Building { jobname } " )
133+
101134 err = subprocess .PIPE
102135 out = subprocess .PIPE
103136 p = subprocess .run (cmd , shell = True , stdout = out , stderr = err )
137+
138+ stop_animation ()
139+
104140 error (p .stderr .decode (), end = "" )
105141 if not p .stderr :
106142 success (f"Built { jobname } ." )
@@ -112,9 +148,9 @@ def call(cls, cmd, jobname):
112148app = App ()
113149app .configure (default = "help" )
114150
115- @app .command ("release" , "dev" )
116- def build (app , job = None ):
117- """Builds the docs. Builds them in all available formats if [release] argument is given.
151+ @app .command ("release" , "dev" , "all" )
152+ def build (app , job = "debug" ):
153+ """Builds the docs. Builds them in all available formats if [release] or [all] argument is given.
118154 * Increases the project version if [release] argument is given.
119155 * Opens the docs/index.html in browser if [dev] argument is given.
120156 * Moves them to where they are needed if [release] or [dev] argument is given."""
@@ -126,12 +162,12 @@ def build(app, job = None):
126162 print ("Starting the build process." )
127163 p = app .call ("make html" , "HTML" )
128164
129- if job == "release" :
165+ if job in ( "release" , "all" ) :
130166 p = app .call ("make singlehtml" , "HTML (single file)" )
131167 p = app .call ("make latexpdf" , "PDF" )
132168 p = app .call ("make epub" , "EPUB" )
133169
134- if job is None :
170+ if job in ( "debug" , "all" ) :
135171 return
136172
137173 import move_documents
0 commit comments