scons: Ensure style_hooks check exits if hook cannot install
If the pre-commit could not be installed the compilation would continue as the exit code from running the pre-commit install script was not read or processed. This commit adds a check. If the install is unsuccessful the users is asked whether they want to continue the compilation or not. This check can be ignored with the '--ignore-style'. The tests have been updated to include this flag in all cases we compile gem5 to ensure tests remain automated and uninterrupted on Kokoro/Jenkins. Change-Id: Iaf4db71300883b828b00d77784c9bb46b2698f89 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63012 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
committed by
Bobby Bruce
parent
92ab557947
commit
700f64c1c1
@@ -87,7 +87,24 @@ def install_style_hooks(env):
|
||||
|
||||
pre_commit_install = env.Dir("#util").File("pre-commit-install.sh")
|
||||
|
||||
subprocess.call(str(pre_commit_install), shell=True)
|
||||
ret = subprocess.call(str(pre_commit_install), shell=True)
|
||||
if ret != 0:
|
||||
print(
|
||||
"It is strongly recommended you install the pre-commit hooks "
|
||||
"before working with gem5. Do you want to continue compilation "
|
||||
"(y/n)?"
|
||||
)
|
||||
while True:
|
||||
response = input().lower().strip()
|
||||
if response in {"yes", "ye", "y"}:
|
||||
return
|
||||
elif response in {"no", "n"}:
|
||||
sys.exit(1)
|
||||
else:
|
||||
print(
|
||||
f"Could not parse answer '{response}'. Do you want to "
|
||||
"continue compilation (y/n)?"
|
||||
)
|
||||
|
||||
|
||||
def generate(env):
|
||||
|
||||
Reference in New Issue
Block a user