diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-02-12 07:26:32 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-02-12 08:35:16 +0300 |
commit | 5a1503953096927860b68f6315e354d2e39fb8bc (patch) | |
tree | b056566eb2c294b5a368b6af766d1d6c9d1075e5 /build_files | |
parent | 9d3d2fa03152cddf49864e4b96f0f77dd98b4507 (diff) |
Cleanup: use the assignment operator with list-comprehension
Diffstat (limited to 'build_files')
-rwxr-xr-x | build_files/cmake/project_info.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/build_files/cmake/project_info.py b/build_files/cmake/project_info.py index 5980d48f85d..dd81602630e 100755 --- a/build_files/cmake/project_info.py +++ b/build_files/cmake/project_info.py @@ -220,14 +220,12 @@ def cmake_advanced_info(): def cmake_cache_var(var): - cache_file = open(join(CMAKE_DIR, "CMakeCache.txt"), encoding='utf-8') - lines = [ - l_strip for l in cache_file - for l_strip in (l.strip(),) - if l_strip - if not l_strip.startswith(("//", "#")) - ] - cache_file.close() + with open(os.path.join(CMAKE_DIR, "CMakeCache.txt"), encoding='utf-8') as cache_file: + lines = [ + l_strip for l in cache_file + if (l_strip := l.strip()) + if not l_strip.startswith(("//", "#")) + ] for l in lines: if l.split(":")[0] == var: |