aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageialinux-online.org>2015-11-01 14:11:39 +0100
committerPapoteur <papoteur@mageialinux-online.org>2015-11-01 14:11:39 +0100
commit5ca32f420f4d92503795b9bca47a303fe1c50c90 (patch)
treeb2a910d15deed3fb4f88422a2ed334d4e52f030d
parenta1efeb369bbd4400521bab3278f229ab06c4e696 (diff)
downloadmgarepo-5ca32f420f4d92503795b9bca47a303fe1c50c90.tar
mgarepo-5ca32f420f4d92503795b9bca47a303fe1c50c90.tar.gz
mgarepo-5ca32f420f4d92503795b9bca47a303fe1c50c90.tar.bz2
mgarepo-5ca32f420f4d92503795b9bca47a303fe1c50c90.tar.xz
mgarepo-5ca32f420f4d92503795b9bca47a303fe1c50c90.zip
Opening spec file from put_srpm function
-rw-r--r--MgaRepo/rpmutil.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/MgaRepo/rpmutil.py b/MgaRepo/rpmutil.py
index 6e39495..321c47d 100644
--- a/MgaRepo/rpmutil.py
+++ b/MgaRepo/rpmutil.py
@@ -287,12 +287,10 @@ def put_srpm(srpmfile, markrelease=False, striplog=True, branch=None,
if striplog:
specpath = specpath
- fspec = open(specpath)
- spec, chlog = log.split_spec_changelog(fspec)
- fspec.close()
- fspec = open(specpath, "w")
- fspec.writelines(spec)
- fspec.close()
+ with open(specpath, "r", encoding='utf-8') as fspec:
+ spec, chlog = log.split_spec_changelog(fspec)
+ with open(specpath, "w", encoding='utf-8') as fspec:
+ fspec.writelines(spec)
chlog.seek(0, os.SEEK_END)
if chlog.tell() != 0:
chlog.seek(0)
@@ -308,9 +306,8 @@ def put_srpm(srpmfile, markrelease=False, striplog=True, branch=None,
try:
svn.checkout(pkgoldurl, logtmp)
miscpath = os.path.join(logtmp, "log")
- fmisc = open(miscpath, "w+")
- fmisc.writelines(chlog)
- fmisc.close()
+ with open(miscpath, "w+", encoding='utf-8') as fmisc:
+ fmisc.writelines(chlog)
svn.add(miscpath)
svn.commit(logtmp,
log="imported old log for %s" % srpm.name)