[GRASS-SVN] r49610 - grass/trunk/scripts/g.extension
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Dec 7 09:38:31 EST 2011
Author: martinl
Date: 2011-12-07 06:38:31 -0800 (Wed, 07 Dec 2011)
New Revision: 49610
Modified:
grass/trunk/scripts/g.extension/g.extension.py
Log:
g.extension: no symlink for executable (only G6 related)
create target dirs if not exists (make install should do this job)
Modified: grass/trunk/scripts/g.extension/g.extension.py
===================================================================
--- grass/trunk/scripts/g.extension/g.extension.py 2011-12-07 13:32:31 UTC (rev 49609)
+++ grass/trunk/scripts/g.extension/g.extension.py 2011-12-07 14:38:31 UTC (rev 49610)
@@ -115,7 +115,7 @@
remove_tmpdir = True
# check requirements
-def check():
+def check_progs():
for prog in ('svn', 'make', 'gcc'):
if not grass.find_program(prog, ['--help']):
grass.fatal(_("'%s' required. Please install '%s' first.") % (prog, prog))
@@ -314,30 +314,7 @@
fd = open(html_man, "w")
fd.write(html_str)
fd.close()
-
- # symlink for binaries needed, see http://trac.osgeo.org/grass/changeset/49124
- src = None
- if sys.platform == 'win32':
- bin_ext = '.exe'
- sct_ext = '.py'
- else:
- bin_ext = sct_ext = ''
- if os.path.exists(os.path.join(options['prefix'], 'bin',
- options['extension'] + bin_ext)):
- src = os.path.join(options['prefix'], 'bin', options['extension']) + bin_ext
- dst = os.path.join(options['prefix'], options['extension']) + bin_ext
- elif os.path.exists(os.path.join(options['prefix'], 'scripts',
- options['extension'] + sct_ext)):
- src = os.path.join(options['prefix'], 'scripts', options['extension']) + sct_ext
- dst = os.path.join(options['prefix'], options['extension']) + sct_ext
-
- if src and not os.path.exists(dst):
- if sys.platform == 'win32':
- shutil.copyfile(src, dst)
- else:
- os.symlink(src, dst)
-
if not os.environ.has_key('GRASS_ADDON_PATH') or \
not os.environ['GRASS_ADDON_PATH']:
grass.warning(_('This add-on module will not function until you set the '
@@ -550,14 +527,30 @@
except OSError, e:
grass.fatal(_("Unable to create '%s': %s") % (addons_file, e))
+def create_dir(path):
+ if os.path.isdir(path):
+ return
+
+ try:
+ os.makedirs(path)
+ except OSError, e:
+ grass.fatal(_("Unable to create '%s': %s") % (path, e))
+
+ grass.debug("'%s' created" % path)
+
def check_dirs():
+ create_dir(os.path.join(options['prefix'], 'bin'))
+ create_dir(os.path.join(options['prefix'], 'docs', 'html'))
check_style_files('grass_logo.png')
- check_style_files('grassdocs.css')
+ check_style_files('grassdocs.css')
+ create_dir(os.path.join(options['prefix'], 'etc'))
+ create_dir(os.path.join(options['prefix'], 'man', 'man1'))
+ create_dir(os.path.join(options['prefix'], 'scripts'))
def main():
# check dependecies
if sys.platform != "win32":
- check()
+ check_progs()
# list available modules
if flags['l'] or flags['c'] or flags['g']:
@@ -585,10 +578,6 @@
grass.warning(_("GRASS_ADDON_PATH has more items, using first defined - '%s'") % path_list[0])
options['prefix'] = path_list[0]
- # check dirs
- if options['operation'] == 'add':
- check_dirs()
-
if flags['d']:
if options['operation'] != 'add':
grass.warning(_("Flag 'd' is relevant only to 'operation=add'. Ignoring this flag."))
@@ -597,7 +586,8 @@
remove_tmpdir = False
if options['operation'] == 'add':
- install_extension()
+ check_dirs()
+ install_extension()
else: # remove
remove_extension(flags['f'])
More information about the grass-commit
mailing list