[GRASS-SVN] r65433 - grass/branches/releasebranch_7_0/scripts/g.extension
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jun 10 06:13:36 PDT 2015
Author: martinl
Date: 2015-06-10 06:13:36 -0700 (Wed, 10 Jun 2015)
New Revision: 65433
Modified:
grass/branches/releasebranch_7_0/scripts/g.extension/g.extension.py
Log:
g.extension: check permission only when GRASS_ADDON_BASE exists
(merge r65432 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-06-10 13:09:13 UTC (rev 65432)
+++ grass/branches/releasebranch_7_0/scripts/g.extension/g.extension.py 2015-06-10 13:13:36 UTC (rev 65433)
@@ -198,7 +198,7 @@
if force:
write_xml_modules(fXML)
else:
- grass.warning(_("No addons metadata file available"))
+ grass.debug(1, "No addons metadata file available")
return []
# read XML file
@@ -702,8 +702,11 @@
# create addons dir if not exists
if not os.path.exists(options['prefix']):
- os.mkdir(options['prefix'])
-
+ try:
+ os.mkdir(options['prefix'])
+ except OSError as e:
+ grass.fatal(_("Unable to create <{}>. {}").format(options['prefix'], e))
+
# download data
fo = tempfile.TemporaryFile()
fo.write(f.read())
@@ -1043,9 +1046,10 @@
else:
options['prefix'] = os.environ['GRASS_ADDON_BASE']
- if not os.access(options['prefix'], os.W_OK):
+ if os.path.exists(options['prefix']) and \
+ not os.access(options['prefix'], os.W_OK):
grass.fatal(_("You don't have permission to install extension to <{}>. "
- "Try to run {} with administrator rights"
+ "Try to run {} with administrator rights "
"(su or sudo).").format(options['prefix'], 'g.extension'))
if 'svn.osgeo.org/grass/grass-addons/grass7' in options['svnurl']:
More information about the grass-commit
mailing list