diff options
author | Gurpreet Singh <gurpreetgs@google.com> | 2023-12-06 16:14:07 +0000 |
---|---|---|
committer | Gurpreet Singh <gurpreetgs@google.com> | 2023-12-06 16:55:53 +0000 |
commit | 789b63dca04c810219011ba150cebab66afa25c9 (patch) | |
tree | 4b26bc89559d0ed49f8578a2cd5560d1e7ba7391 | |
parent | 6d6755189d9380cc494d9158ad482de422f3beb5 (diff) | |
download | common-789b63dca04c810219011ba150cebab66afa25c9.tar.gz |
create directory before writing into the file.
The with open() method creates the file if it does not exist, but
gives a FileNotFound error if the path does not exist.
Hence, creating the path directories before using the file.
Bug: N/A
Test: the build passes.
Change-Id: Id5b285ea5581f7ef526876fb6e13a3bf69098acd
-rwxr-xr-x | build/mainline_modules_sdks.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/build/mainline_modules_sdks.py b/build/mainline_modules_sdks.py index 1eaa71e0..71d78536 100755 --- a/build/mainline_modules_sdks.py +++ b/build/mainline_modules_sdks.py @@ -1307,6 +1307,7 @@ class SdkDistProducer: def dist_generate_sdk_supported_modules_file(self, modules): sdk_modules_file = os.path.join(self.dist_dir, "sdk-modules.txt") + os.makedirs(os.path.dirname(sdk_modules_file), exist_ok=True) with open(sdk_modules_file, "w", encoding="utf8") as file: for module in modules: if module in MAINLINE_MODULES: |