build:wafsamba: Close file handles in the build scripts too
[gd/samba-autobuild/.git] / buildtools / wafsamba / samba_version.py
index bb0be96f86942e6900b43a90c62e562881b87791..950a855c1efceee416a0a79fc911bbd824ded697 100644 (file)
@@ -42,12 +42,10 @@ def git_version_summary(path, env=None):
 
 def distversion_version_summary(path):
     #get version from .distversion file
-    f = open(path + '/.distversion', 'r')
     suffix = None
     fields = {}
 
-    for line in f:
-        line = line.strip()
+    for line in Utils.readf(path + '/.distversion').splitlines():
         if line == '':
             continue
         if line.startswith("#"):
@@ -64,7 +62,6 @@ def distversion_version_summary(path):
         except:
             print("Failed to parse line %s from .distversion file." % (line))
             raise
-    f.close()
 
     if "COMMIT_TIME" in fields:
         fields["COMMIT_TIME"] = int(fields["COMMIT_TIME"])