@@ -127,13 +127,13 @@ def unpack(tarball, dst, verbose=False, match=None):
127127 shutil .move (tp , fp )
128128 shutil .rmtree (os .path .join (dst , fname ))
129129
130- def run (args , verbose = False , exception = False , cwd = None ):
130+ def run (args , verbose = False , exception = False , cwd = None , env = None ):
131131 if verbose :
132132 print ("running: " + ' ' .join (args ))
133133 sys .stdout .flush ()
134134 # Use Popen here instead of call() as it apparently allows powershell on
135135 # Windows to not lock up waiting for input presumably.
136- ret = subprocess .Popen (args , cwd = cwd )
136+ ret = subprocess .Popen (args , cwd = cwd , env = env )
137137 code = ret .wait ()
138138 if code != 0 :
139139 err = "failed to run: " + ' ' .join (args )
@@ -385,17 +385,15 @@ def build_bootstrap(self):
385385 raise Exception ("no cargo executable found at `%s`" % self .cargo ())
386386 args = [self .cargo (), "build" , "--manifest-path" ,
387387 os .path .join (self .rust_root , "src/bootstrap/Cargo.toml" )]
388+ if self .verbose :
389+ args .append ("--verbose" )
390+ if self .verbose > 1 :
391+ args .append ("--verbose" )
388392 if self .use_locked_deps :
389393 args .append ("--locked" )
390394 if self .use_vendored_sources :
391395 args .append ("--frozen" )
392- self .run (args , env )
393-
394- def run (self , args , env = None , cwd = None ):
395- proc = subprocess .Popen (args , env = env , cwd = cwd )
396- ret = proc .wait ()
397- if ret != 0 :
398- sys .exit (ret )
396+ run (args , env = env , verbose = self .verbose )
399397
400398 def output (self , args , env = None , cwd = None ):
401399 default_encoding = sys .getdefaultencoding ()
@@ -567,7 +565,7 @@ def update_submodules(self):
567565 path = line [1 :].split (' ' )[1 ]
568566 submodules .append ([path , line [0 ]])
569567
570- self . run (["git" , "submodule" , "sync" ], cwd = self .rust_root )
568+ run (["git" , "submodule" , "sync" ], cwd = self .rust_root )
571569
572570 for submod in submodules :
573571 path , status = submod
@@ -580,15 +578,15 @@ def update_submodules(self):
580578 submod_path = os .path .join (self .rust_root , path )
581579
582580 if status == ' ' :
583- self . run (["git" , "reset" , "--hard" ], cwd = submod_path )
584- self . run (["git" , "clean" , "-fdx" ], cwd = submod_path )
581+ run (["git" , "reset" , "--hard" ], cwd = submod_path )
582+ run (["git" , "clean" , "-fdx" ], cwd = submod_path )
585583 elif status == '+' :
586- self . run (["git" , "submodule" , "update" , path ], cwd = self .rust_root )
587- self . run (["git" , "reset" , "--hard" ], cwd = submod_path )
588- self . run (["git" , "clean" , "-fdx" ], cwd = submod_path )
584+ run (["git" , "submodule" , "update" , path ], cwd = self .rust_root )
585+ run (["git" , "reset" , "--hard" ], cwd = submod_path )
586+ run (["git" , "clean" , "-fdx" ], cwd = submod_path )
589587 elif status == '-' :
590- self . run (["git" , "submodule" , "init" , path ], cwd = self .rust_root )
591- self . run (["git" , "submodule" , "update" , path ], cwd = self .rust_root )
588+ run (["git" , "submodule" , "init" , path ], cwd = self .rust_root )
589+ run (["git" , "submodule" , "update" , path ], cwd = self .rust_root )
592590 else :
593591 raise ValueError ('unknown submodule status: ' + status )
594592
@@ -620,6 +618,11 @@ def bootstrap():
620618 except :
621619 pass
622620
621+ if '\n verbose = 2' in rb .config_toml :
622+ rb .verbose = 2
623+ elif '\n verbose = 1' in rb .config_toml :
624+ rb .verbose = 1
625+
623626 rb .use_vendored_sources = '\n vendor = true' in rb .config_toml or \
624627 'CFG_ENABLE_VENDOR' in rb .config_mk
625628
@@ -676,7 +679,7 @@ def bootstrap():
676679 env ["BUILD" ] = rb .build
677680 env ["SRC" ] = rb .rust_root
678681 env ["BOOTSTRAP_PARENT_ID" ] = str (os .getpid ())
679- rb . run (args , env )
682+ run (args , env = env , verbose = rb . verbose )
680683
681684def main ():
682685 start_time = time ()
0 commit comments