diff options
author | Rob Mohr <mohrr@google.com> | 2023-01-31 05:18:21 +0000 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-01-31 05:18:21 +0000 |
commit | 8d2bb3f418ccf3106ee4efb90d0a07bca1c04170 (patch) | |
tree | 7229e1a5a8213416c75244a5fcc82fc2f6725312 | |
parent | 500dbcca8476653fb8bca18a30e419a50123d3d8 (diff) | |
download | pigweed-8d2bb3f418ccf3106ee4efb90d0a07bca1c04170.tar.gz |
pw_env_setup: Clear PW_ENVIRONMENT_ROOT
Clear PW_ENVIRONMENT_ROOT after bootstrap completes. This reduces the
errors when switching between workspaces in the same terminal.
Change-Id: I0b7300af99e29ffded79abdce19ef6c3917cf810
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/127032
Reviewed-by: Chad Norvell <chadnorvell@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
-rw-r--r-- | pw_env_setup/docs.rst | 3 | ||||
-rw-r--r-- | pw_env_setup/util.sh | 12 |
2 files changed, 9 insertions, 6 deletions
diff --git a/pw_env_setup/docs.rst b/pw_env_setup/docs.rst index fae85652a..9f6bee03f 100644 --- a/pw_env_setup/docs.rst +++ b/pw_env_setup/docs.rst @@ -431,7 +431,8 @@ never need to set these. ``PW_ENVIRONMENT_ROOT`` Location to which packages are installed. Defaults to ``environment`` folder - within the checkout root. + within the checkout root. This variable is cleared after environment setup is + complete. ``PW_ENVSETUP_DISABLE_SPINNER`` Disable the spinner during env setup. Intended to be used when the output is diff --git a/pw_env_setup/util.sh b/pw_env_setup/util.sh index a5b81f3fb..c6e66f1bb 100644 --- a/pw_env_setup/util.sh +++ b/pw_env_setup/util.sh @@ -110,11 +110,12 @@ pw_check_root() { } pw_get_env_root() { - # PW_ENVIRONMENT_ROOT allows developers to specify where the environment - # should be installed. bootstrap.sh scripts should not use that variable to - # store the result of this function. This separation allows scripts to assume - # PW_ENVIRONMENT_ROOT came from the developer and not from a previous - # bootstrap possibly from another workspace. + # PW_ENVIRONMENT_ROOT allows callers to specify where the environment should + # be installed. bootstrap.sh scripts should not use that variable to store the + # result of this function. This separation allows scripts to assume + # PW_ENVIRONMENT_ROOT came from the caller and not from a previous bootstrap + # possibly from another workspace. PW_ENVIRONMENT_ROOT will be cleared after + # environment setup completes. if [ -n "$PW_ENVIRONMENT_ROOT" ]; then echo "$PW_ENVIRONMENT_ROOT" return @@ -361,6 +362,7 @@ pw_cleanup() { unset PW_BANNER_FUNC unset _PW_ENV_SETUP unset _PW_NAME + unset PW_ENVIRONMENT_ROOT unset _PW_PYTHON unset _PW_ENV_ROOT_TXT unset _PW_PREV_ENV_ROOT |