bootstrap.py: Report build status
Move some code from x.py to bootstrap.py
This commit is contained in:
parent
3b454665ea
commit
11adac350b
@ -8,6 +8,7 @@
|
|||||||
# option. This file may not be copied, modified, or distributed
|
# option. This file may not be copied, modified, or distributed
|
||||||
# except according to those terms.
|
# except according to those terms.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import argparse
|
import argparse
|
||||||
import contextlib
|
import contextlib
|
||||||
import datetime
|
import datetime
|
||||||
@ -501,7 +502,7 @@ class RustBuild(object):
|
|||||||
|
|
||||||
return "{}-{}".format(cputype, ostype)
|
return "{}-{}".format(cputype, ostype)
|
||||||
|
|
||||||
def main():
|
def bootstrap():
|
||||||
parser = argparse.ArgumentParser(description='Build rust')
|
parser = argparse.ArgumentParser(description='Build rust')
|
||||||
parser.add_argument('--config')
|
parser.add_argument('--config')
|
||||||
parser.add_argument('--clean', action='store_true')
|
parser.add_argument('--clean', action='store_true')
|
||||||
@ -564,8 +565,6 @@ def main():
|
|||||||
rb._rustc_channel, rb._rustc_date = data['rustc'].split('-', 1)
|
rb._rustc_channel, rb._rustc_date = data['rustc'].split('-', 1)
|
||||||
rb._cargo_rev = data['cargo']
|
rb._cargo_rev = data['cargo']
|
||||||
|
|
||||||
start_time = time()
|
|
||||||
|
|
||||||
# Fetch/build the bootstrap
|
# Fetch/build the bootstrap
|
||||||
rb.build = rb.build_triple()
|
rb.build = rb.build_triple()
|
||||||
rb.download_stage0()
|
rb.download_stage0()
|
||||||
@ -582,9 +581,19 @@ def main():
|
|||||||
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
|
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
|
||||||
rb.run(args, env)
|
rb.run(args, env)
|
||||||
|
|
||||||
end_time = time()
|
def main():
|
||||||
|
start_time = time()
|
||||||
print("Build completed in %s" % format_build_time(end_time - start_time))
|
try:
|
||||||
|
bootstrap()
|
||||||
|
print("Build completed successfully in %s" % format_build_time(time() - start_time))
|
||||||
|
except (SystemExit, KeyboardInterrupt) as e:
|
||||||
|
if hasattr(e, 'code') and isinstance(e.code, int):
|
||||||
|
exit_code = e.code
|
||||||
|
else:
|
||||||
|
exit_code = 1
|
||||||
|
print(e)
|
||||||
|
print("Build completed unsuccessfully in %s" % format_build_time(time() - start_time))
|
||||||
|
sys.exit(exit_code)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
14
x.py
14
x.py
@ -9,14 +9,12 @@
|
|||||||
# option. This file may not be copied, modified, or distributed
|
# option. This file may not be copied, modified, or distributed
|
||||||
# except according to those terms.
|
# except according to those terms.
|
||||||
|
|
||||||
import sys
|
# This file is only a "symlink" to boostrap.py, all logic should go there.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
dir = os.path.dirname(__file__)
|
import sys
|
||||||
sys.path.append(os.path.abspath(os.path.join(dir, "src", "bootstrap")))
|
rust_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
sys.path.append(os.path.join(rust_dir, "src", "bootstrap"))
|
||||||
|
|
||||||
import bootstrap
|
import bootstrap
|
||||||
|
bootstrap.main()
|
||||||
try:
|
|
||||||
bootstrap.main()
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
sys.exit()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user