[GRASS-SVN] r64920 - grass/trunk/scripts/g.extension
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Mar 25 13:12:49 PDT 2015
Author: martinl
Date: 2015-03-25 13:12:49 -0700 (Wed, 25 Mar 2015)
New Revision: 64920
Modified:
grass/trunk/scripts/g.extension/g.extension.py
Log:
g.extention: improve handling of broken zipfiles on Windows
Modified: grass/trunk/scripts/g.extension/g.extension.py
===================================================================
--- grass/trunk/scripts/g.extension/g.extension.py 2015-03-25 14:34:43 UTC (rev 64919)
+++ grass/trunk/scripts/g.extension/g.extension.py 2015-03-25 20:12:49 UTC (rev 64920)
@@ -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