Skip to content

Commit 2269ff5

Browse files
committed
Remove print_what_bootstrap_means
It was an existing solution to tell the user why a --help command takes a long time to process. However, it would only print if the stage0 rust compiler needed to be downloaded, it came after update_submodules (which took a long time), and it was immediately followed by download messages and loading bars, meaning users could easily gloss over the message. This commit also moves the help message out of main(), and instead puts it at the top of bootstrap(). main() is intended to be minimal, only handling error messages.
1 parent ffb6291 commit 2269ff5

File tree

1 file changed

+8
-27
lines changed

1 file changed

+8
-27
lines changed

src/bootstrap/bootstrap.py

+8-27
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ def __init__(self):
314314
self.build_dir = os.path.join(os.getcwd(), "build")
315315
self.clean = False
316316
self.config_toml = ''
317-
self.printed = False
318317
self.rust_root = os.path.abspath(os.path.join(__file__, '../../..'))
319318
self.use_locked_deps = ''
320319
self.use_vendored_sources = ''
@@ -336,7 +335,6 @@ def download_stage0(self):
336335
if self.rustc().startswith(self.bin_root()) and \
337336
(not os.path.exists(self.rustc()) or
338337
self.program_out_of_date(self.rustc_stamp())):
339-
self.print_what_bootstrap_means()
340338
if os.path.exists(self.bin_root()):
341339
shutil.rmtree(self.bin_root())
342340
filename = "rust-std-{}-{}.tar.gz".format(
@@ -354,7 +352,6 @@ def download_stage0(self):
354352
if self.cargo().startswith(self.bin_root()) and \
355353
(not os.path.exists(self.cargo()) or
356354
self.program_out_of_date(self.cargo_stamp())):
357-
self.print_what_bootstrap_means()
358355
filename = "cargo-{}-{}.tar.gz".format(cargo_channel, self.build)
359356
self._download_stage0_helper(filename, "cargo")
360357
self.fix_executable("{}/bin/cargo".format(self.bin_root()))
@@ -555,23 +552,6 @@ def exe_suffix():
555552
return '.exe'
556553
return ''
557554

558-
def print_what_bootstrap_means(self):
559-
"""Prints more information about the build system"""
560-
if hasattr(self, 'printed'):
561-
return
562-
self.printed = True
563-
if os.path.exists(self.bootstrap_binary()):
564-
return
565-
if '--help' not in sys.argv or len(sys.argv) == 1:
566-
return
567-
568-
print('info: the build system for Rust is written in Rust, so this')
569-
print(' script is now going to download a stage0 rust compiler')
570-
print(' and then compile the build system itself')
571-
print('')
572-
print('info: in the meantime you can read more about rustbuild at')
573-
print(' src/bootstrap/README.md before the download finishes')
574-
575555
def bootstrap_binary(self):
576556
"""Return the path of the boostrap binary
577557
@@ -585,7 +565,6 @@ def bootstrap_binary(self):
585565

586566
def build_bootstrap(self):
587567
"""Build bootstrap"""
588-
self.print_what_bootstrap_means()
589568
build_dir = os.path.join(self.build_dir, "bootstrap")
590569
if self.clean and os.path.exists(build_dir):
591570
shutil.rmtree(build_dir)
@@ -672,6 +651,14 @@ def set_dev_environment(self):
672651

673652
def bootstrap(help_triggered):
674653
"""Configure, fetch, build and run the initial bootstrap"""
654+
655+
# If the user is asking for help, let them know that the whole download-and-build
656+
# process has to happen before anything is printed out.
657+
if help_triggered:
658+
print("info: Downloading and building bootstrap before processing --help")
659+
print(" command. See src/bootstrap/README.md for help with common")
660+
print(" commands.")
661+
675662
parser = argparse.ArgumentParser(description='Build rust')
676663
parser.add_argument('--config')
677664
parser.add_argument('--build')
@@ -763,12 +750,6 @@ def main():
763750
help_triggered = (
764751
'-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1)
765752
try:
766-
# If the user is asking for help, let them know that the whole download-and-build
767-
# process has to happen before anything is printed out.
768-
if help_triggered:
769-
print("NOTE: Downloading and compiling bootstrap requirements before processing")
770-
print(" --help command. See src/bootstrap/README.md for help with common")
771-
print(" commands.")
772753
bootstrap(help_triggered)
773754
if not help_triggered:
774755
print("Build completed successfully in {}".format(

0 commit comments

Comments
 (0)