diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2018-10-11 15:18:42 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2018-10-11 15:18:42 +0100 |
commit | 6e1bf2b760c9f824ee569da955028622336ba27d (patch) | |
tree | b294b2f49e65a4051bb0891d5f02c70fc894e76a /python | |
parent | db69b6691fed6ea7786e25468f931457ba6f16ef (diff) | |
download | android_build_soong-6e1bf2b760c9f824ee569da955028622336ba27d.tar.gz android_build_soong-6e1bf2b760c9f824ee569da955028622336ba27d.tar.bz2 android_build_soong-6e1bf2b760c9f824ee569da955028622336ba27d.zip |
Define runfiles_path before try so that finally can use it.
Otherwise, python will complain the variable has not been initialized,
in case ExtractRunFiles throws an exception.
Test: m
Change-Id: I3d9e3cda5e558436ee4182c44e4345151c031e41
Diffstat (limited to 'python')
-rw-r--r-- | python/scripts/stub_template_host.txt | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/python/scripts/stub_template_host.txt b/python/scripts/stub_template_host.txt index e6862114..213401dc 100644 --- a/python/scripts/stub_template_host.txt +++ b/python/scripts/stub_template_host.txt @@ -41,6 +41,7 @@ def Main(): args = sys.argv[1:] new_env = {} + runfiles_path = None try: runfiles_path = ExtractRunfiles() @@ -82,7 +83,8 @@ def Main(): except: raise finally: - shutil.rmtree(runfiles_path, True) + if runfiles_path is not None: + shutil.rmtree(runfiles_path, True) if __name__ == '__main__': Main() |