[master][PATCH] Work with files in a more pythonic way in makeupdates
Vratislav Podzimek
vpodzime at redhat.com
Fri Jul 26 08:42:54 UTC 2013
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
scripts/makeupdates | 34 ++++++++++++++--------------------
1 file changed, 14 insertions(+), 20 deletions(-)
diff --git a/scripts/makeupdates b/scripts/makeupdates
index 8d82d37..16255c4 100755
--- a/scripts/makeupdates
+++ b/scripts/makeupdates
@@ -39,27 +39,21 @@ KOJI_BASE_URL = "http://kojipkgs.fedoraproject.org//packages/" \
def getArchiveTag(configure, spec):
tag = ""
- f = open(configure)
- lines = f.readlines()
- f.close()
-
- for line in lines:
- if line.startswith('AC_INIT('):
- fields = line.split('[')
- tag += fields[1].split(']')[0] + '-' + fields[2].split(']')[0]
- break
- else:
- continue
-
- f = open(spec)
- lines = f.readlines()
- f.close()
+ with open(configure, "r") as f:
+ for line in f:
+ if line.startswith('AC_INIT('):
+ fields = line.split('[')
+ tag += fields[1].split(']')[0] + '-' + fields[2].split(']')[0]
+ break
+ else:
+ continue
- for line in lines:
- if line.startswith('Release:'):
- tag += '-' + line.split()[1].split('%')[0]
- else:
- continue
+ with open(spec, "r") as f:
+ for line in f:
+ if line.startswith('Release:'):
+ tag += '-' + line.split()[1].split('%')[0]
+ else:
+ continue
return tag
--
1.7.11.7
More information about the anaconda-patches
mailing list