From ae1b63709c9dd67e9994ff56212f20b4dbcd068d Mon Sep 17 00:00:00 2001 From: David Brownell Date: Sat, 6 Apr 2024 19:50:02 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20[+feature]=20Added=20decoration=20w?= =?UTF-8?q?hen=20bootstrapped=20w/package=20flag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ActivateEpilog.py | 24 ++++++++++++++++++++++++ BootstrapEpilog.py | 11 +++++++++++ 2 files changed, 35 insertions(+) create mode 100644 ActivateEpilog.py diff --git a/ActivateEpilog.py b/ActivateEpilog.py new file mode 100644 index 0000000..a7530e4 --- /dev/null +++ b/ActivateEpilog.py @@ -0,0 +1,24 @@ +# ---------------------------------------------------------------------- +# | +# | ActivateEpilog.py +# | +# | David Brownell +# | 2024-04-06 19:49:00 +# | +# ---------------------------------------------------------------------- +# | +# | Copyright David Brownell 2024 +# | Distributed under the MIT License. +# | +# ---------------------------------------------------------------------- +import json +import os +import sys + +from pathlib import Path + +with (Path(os.environ["PYTHON_BOOTSTRAPPER_GENERATED_DIR"]) / "bootstrap_flags.json").open() as f: + flags = json.load(f) + +if flags: + sys.stdout.write("\nBootstrapped with {}.\n".format(", ".join(f"'{flag}'" for flag in flags))) diff --git a/BootstrapEpilog.py b/BootstrapEpilog.py index 56265d2..073de4b 100644 --- a/BootstrapEpilog.py +++ b/BootstrapEpilog.py @@ -11,9 +11,12 @@ # | Distributed under the MIT License. # | # ---------------------------------------------------------------------- +import os import subprocess import sys +from pathlib import Path + # Parse the arguments is_debug = False is_force = False @@ -21,6 +24,8 @@ is_package = False no_cache = False +display_flags: list[str] = [] + for arg in sys.argv[ 2: ]: # First arg is the script name, second arg is the name of the shell script to write to @@ -32,6 +37,7 @@ is_verbose = True elif arg == "--package": is_package = True + display_flags.append("package") elif arg == "--no-cache": no_cache = True else: @@ -48,3 +54,8 @@ check=True, shell=True, ) + +with ( + Path(__file__).parent / os.environ["PYTHON_BOOTSTRAPPER_GENERATED_DIR"] / "bootstrap_flags.json" +).open("w") as f: + f.write("[{}]".format(", ".join(f'"{flag}"' for flag in display_flags)))