[GRASS-SVN] r65153 - grass/branches/releasebranch_7_0/scripts/g.extension
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Apr 27 06:40:00 PDT 2015
Author: martinl
Date: 2015-04-27 06:40:00 -0700 (Mon, 27 Apr 2015)
New Revision: 65153
Modified:
grass/branches/releasebranch_7_0/scripts/g.extension/g.extension.py
Log:
g.extention: improve handling of broken zipfiles on Windows
(merge r64920 from trunk)
Modified: grass/branches/releasebranch_7_0/scripts/g.extension/g.extension.py
===================================================================
--- grass/branches/releasebranch_7_0/scripts/g.extension/g.extension.py 2015-04-27 11:08:52 UTC (rev 65152)
+++ grass/branches/releasebranch_7_0/scripts/g.extension/g.extension.py 2015-04-27 13:40:00 UTC (rev 65153)
@@ -697,7 +697,8 @@
grass.debug("url=%s" % url, 1)
try:
- f = urlopen(url + '/' + name + '.zip', proxies=PROXIES)
+ zfile = url + name + '.zip'
+ f = urlopen(zfile, proxies=PROXIES)
# create addons dir if not exists
if not os.path.exists(options['prefix']):
@@ -706,7 +707,11 @@
# download data
fo = tempfile.TemporaryFile()
fo.write(f.read())
- zfobj = zipfile.ZipFile(fo)
+ try:
+ zfobj = zipfile.ZipFile(fo)
+ except zipfile.BadZipfile as e:
+ grass.fatal('%s: %s' % (e, zfile))
+
for name in zfobj.namelist():
if name.endswith('/'):
d = os.path.join(options['prefix'], name)
More information about the grass-commit
mailing list