diff options
author | Denis Fortin <denis.fortin@vitec.com> | 2022-07-27 17:56:01 +0200 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2022-08-08 19:10:32 +0530 |
commit | e62ae024ae099b6c6a42ea4ebe806272e1a2fb52 (patch) | |
tree | 118982d3140593b1f07e9007d193a0558b6860aa | |
parent | 5c2703b2da9b0e04ab4d64bb49835dbc8cdcf72c (diff) | |
download | meson-e62ae024ae099b6c6a42ea4ebe806272e1a2fb52.zip meson-e62ae024ae099b6c6a42ea4ebe806272e1a2fb52.tar.gz meson-e62ae024ae099b6c6a42ea4ebe806272e1a2fb52.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: |