diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2016-09-22 12:11:37 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2016-09-22 10:28:53 +0000 |
commit | 806dfdafa803d643937bc6edcd1aaebeddfeb7ac (patch) | |
tree | e9bff3d5b1b0da174e2a56a94b427e49d075a84f /solenv/gbuild | |
parent | 769f640558dbaf787059bd8131f174a9b1e6d7d0 (diff) |
Use 'with open(file) as f:' to avoid 'ResourceWarning: unclosed file'
Removes 220 warnings from build log (at least under Windows).
Requires Python 2.5+
Change-Id: I06b18b14a08f2c27528fcb009faddff081ffd54e
Reviewed-on: https://gerrit.libreoffice.org/29172
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'solenv/gbuild')
-rw-r--r-- | solenv/gbuild/gen-autoinstall.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/solenv/gbuild/gen-autoinstall.py b/solenv/gbuild/gen-autoinstall.py index 6c0e4ad16074..61ed81ad7f8f 100644 --- a/solenv/gbuild/gen-autoinstall.py +++ b/solenv/gbuild/gen-autoinstall.py @@ -18,11 +18,17 @@ scp2componentcondition = sys.argv[2] scp2libtemplate = sys.argv[3] scp2exetemplate = sys.argv[4] scp2jartemplate = sys.argv[5] -sdklibs = open(sys.argv[6]).readline().split() -libs = open(sys.argv[7]).readline().split() -exes = open(sys.argv[8]).readline().split() -jars = open(sys.argv[9]).readline().split() -pkgs = open(sys.argv[10]).readline().split() +# use 'with open(file) as f:' to avoid 'ResourceWarning: unclosed file' +with open(sys.argv[6]) as f: + sdklibs = f.readline().split() +with open(sys.argv[7]) as f: + libs = f.readline().split() +with open(sys.argv[8]) as f: + exes = f.readline().split() +with open(sys.argv[9]) as f: + jars = f.readline().split() +with open(sys.argv[10]) as f: + pkgs = f.readline().split() if len(scp2componentcondition) > 0: scp2componentcondition = "," + scp2componentcondition |