diff options
author | Denis Fortin <denis.fortin@vitec.com> | 2022-07-27 17:56:01 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2022-08-02 21:12:31 +0300 |
commit | e1bf8f0f0c683107de4e8a81cc276102125a1a58 (patch) | |
tree | 7e92fe013a3edf97b65e78363acd66b797400554 | |
parent | 27626124d0bdd89f5f276f70a73b4713aa3aac3d (diff) | |
download | meson-e1bf8f0f0c683107de4e8a81cc276102125a1a58.zip meson-e1bf8f0f0c683107de4e8a81cc276102125a1a58.tar.gz meson-e1bf8f0f0c683107de4e8a81cc276102125a1a58.tar.bz2 |
Handle garbage in environment more gracefully when setting vsenv
Environment line may not contain '=' and thus fail to decompose into a
key/value pair.
-rw-r--r-- | mesonbuild/mesonlib/vsenv.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/mesonbuild/mesonlib/vsenv.py b/mesonbuild/mesonlib/vsenv.py index 0d37765..4eab428 100644 --- a/mesonbuild/mesonlib/vsenv.py +++ b/mesonbuild/mesonlib/vsenv.py @@ -96,8 +96,13 @@ def _setup_vsenv(force: bool) -> bool: continue if not bat_line: continue - k, v = bat_line.split('=', 1) - os.environ[k] = v + try: + k, v = bat_line.split('=', 1) + except ValueError: + # there is no "=", ignore junk data + pass + else: + os.environ[k] = v return True def setup_vsenv(force: bool = False) -> bool: |