[GRASS-SVN] r46871 - grass/trunk/scripts/g.extension

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jun 30 10:43:33 EDT 2011


Author: martinl
Date: 2011-06-30 07:43:33 -0700 (Thu, 30 Jun 2011)
New Revision: 46871

Modified:
   grass/trunk/scripts/g.extension/g.extension.py
Log:
g.extension: define also 'etc' dir


Modified: grass/trunk/scripts/g.extension/g.extension.py
===================================================================
--- grass/trunk/scripts/g.extension/g.extension.py	2011-06-30 14:42:54 UTC (rev 46870)
+++ grass/trunk/scripts/g.extension/g.extension.py	2011-06-30 14:43:33 UTC (rev 46871)
@@ -287,7 +287,7 @@
     if remove_tmpdir:
         grass.try_rmdir(tmpdir)
     else:
-        grass.info(_("Path to the source code: '%s'") % tmpdir)
+        grass.info(_("Path to the source code: '%s'") % os.path.join(tmpdir, options['extension']))
                         
 def install_extension():
     gisbase = os.getenv('GISBASE')
@@ -319,29 +319,45 @@
     if grass.call(['svn', 'checkout',
                    url], stdout = outdev) != 0:
         grass.fatal(_("GRASS Addons '%s' not found in repository") % options['extension'])
-
+    
+    dirs = { 'bin' : os.path.join(tmpdir, options['extension'], 'bin'),
+             'docs' : os.path.join(tmpdir, options['extension'], 'docs'),
+             'html' : os.path.join(tmpdir, options['extension'], 'docs', 'html'),
+             'man' : os.path.join(tmpdir, options['extension'], 'man'),
+             'man1' : os.path.join(tmpdir, options['extension'], 'man', 'man1'),
+             'scripts' : os.path.join(tmpdir, options['extension'], 'scripts'),
+             'etc' : os.path.join(tmpdir, options['extension'], 'etc'),
+             }
+    
+    makeCmd = ['make',
+               'MODULE_TOPDIR=%s' % gisbase.replace(' ', '\ '),
+               'BIN=%s' % dirs['bin'],
+               'HTMLDIR=%s' % dirs['html'],
+               'MANDIR=%s' % dirs['man1'],
+               'SCRIPTDIR=%s' % dirs['scripts'],
+               'ETC=%s' % dirs['etc']
+               ]
+    
+    installCmd = ['make',
+                  'MODULE_TOPDIR=%s' % gisbase,
+                  'ARCH_DISTDIR=%s' % os.path.join(tmpdir, options['extension']),
+                  'INST_DIR=%s' % options['prefix'],
+                  'install'
+                  ]
+    
     if flags['d']:
+        sys.stderr.write(' '.join(makeCmd) + '\n')
+        sys.stderr.write(' '.join(installCmd) + '\n')
         return
     
     os.chdir(os.path.join(tmpdir, options['extension']))
-
+    
     grass.message(_("Compiling '%s'...") % options['extension'])    
     if options['extension'] not in gui_list:
-        bin_dir  = os.path.join(tmpdir, options['extension'], 'bin')
-        docs_dir = os.path.join(tmpdir, options['extension'], 'docs')
-        html_dir = os.path.join(docs_dir, 'html')
-        man_dir  = os.path.join(tmpdir, options['extension'], 'man')
-        man1_dir = os.path.join(man_dir, 'man1')
-        script_dir = os.path.join(tmpdir, options['extension'], 'scripts')
-        for d in (bin_dir, docs_dir, html_dir, man_dir, man1_dir, script_dir):
+        for d in dirs.itervalues():
             os.mkdir(d)
         
-        ret = grass.call(['make',
-                          'MODULE_TOPDIR=%s' % gisbase.replace(' ', '\ '),
-                          'BIN=%s' % bin_dir,
-                          'HTMLDIR=%s' % html_dir,
-                          'MANDIR=%s' % man1_dir,
-                          'SCRIPTDIR=%s' % script_dir],
+        ret = grass.call(makeCmd,
                          stdout = outdev)
     else:
         ret = grass.call(['make',
@@ -356,11 +372,7 @@
     
     grass.message(_("Installing '%s'...") % options['extension'])
     
-    ret = grass.call(['make',
-                      'MODULE_TOPDIR=%s' % gisbase,
-                      'ARCH_DISTDIR=%s' % os.path.join(tmpdir, options['extension']),
-                      'INST_DIR=%s' % options['prefix'],
-                      'install'],
+    ret = grass.call(installCmd,
                      stdout = outdev)
     
     if ret != 0:



More information about the grass-commit mailing list