[GRASS-SVN] r45796 - in grass/trunk: include/Make scripts/g.extension

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Mar 28 09:12:09 EDT 2011


Author: martinl
Date: 2011-03-28 06:12:09 -0700 (Mon, 28 Mar 2011)
New Revision: 45796

Modified:
   grass/trunk/include/Make/Install.make
   grass/trunk/scripts/g.extension/g.extension.py
Log:
making g.extension really working


Modified: grass/trunk/include/Make/Install.make
===================================================================
--- grass/trunk/include/Make/Install.make	2011-03-28 13:04:22 UTC (rev 45795)
+++ grass/trunk/include/Make/Install.make	2011-03-28 13:12:09 UTC (rev 45796)
@@ -91,6 +91,7 @@
 FONTCAP = etc/fontcap
 TMPGISRC = demolocation/.grassrc$(GRASS_VERSION_MAJOR)$(GRASS_VERSION_MINOR)
 PLATMAKE = include/Make/Platform.make
+GRASSMAKE = include/Make/Grass.make
 
 real-install: | $(INST_DIR) $(UNIX_BIN)
 	$(MAKE) $(STARTUP)
@@ -106,6 +107,9 @@
 	-rm $(INST_DIR)/$(PLATMAKE)
 	$(MAKE) $(INST_DIR)/$(PLATMAKE)
 
+	-rm $(INST_DIR)/$(GRASSMAKE)
+	$(MAKE) $(INST_DIR)/$(GRASSMAKE)
+
 	-$(INSTALL) config.status $(INST_DIR)/config.status
 	-$(CHMOD) -R a+rX $(INST_DIR) 2>/dev/null
 
@@ -128,6 +132,11 @@
 sed -e 's#$(GISBASE)#$(INST_DIR)#g' $< > $@
 endef
 
+define fix_grass_arch
+sed -e 's#^ARCH_DISTDIR.*#ARCH_DISTDIR	= $(INST_DIR)#g' \
+    -e 's#^ARCH_BINDIR.*#ARCH_BINDIR	= $(UNIX_BIN)#g' $< > $@
+endef
+
 $(INST_DIR)/$(FONTCAP): $(GISBASE)/$(FONTCAP)
 	$(call fix_gisbase)
 
@@ -137,6 +146,9 @@
 $(INST_DIR)/$(PLATMAKE): $(GISBASE)/$(PLATMAKE)
 	$(call fix_gisbase)
 
+$(INST_DIR)/$(GRASSMAKE): $(GISBASE)/$(GRASSMAKE)
+	$(call fix_grass_arch)
+
 install-macosx:
 	$(MAKE) -C macosx install-macosx
 

Modified: grass/trunk/scripts/g.extension/g.extension.py
===================================================================
--- grass/trunk/scripts/g.extension/g.extension.py	2011-03-28 13:04:22 UTC (rev 45795)
+++ grass/trunk/scripts/g.extension/g.extension.py	2011-03-28 13:12:09 UTC (rev 45796)
@@ -96,9 +96,7 @@
 
 # temp dir
 remove_tmpdir = True
-tmpdir = grass.tempfile()
-grass.try_remove(tmpdir)
-os.mkdir(tmpdir)
+tmpdir = grass.tempdir()
 
 def check():
     for prog in ('svn', 'make', 'install', 'gcc'):
@@ -326,9 +324,20 @@
     
     os.chdir(os.path.join(tmpdir, module))
     
+    bin_dir  = os.path.join(tmpdir, module, 'bin')
+    docs_dir = os.path.join(tmpdir, module, 'docs')
+    html_dir = os.path.join(docs_dir, 'html')
+    man_dir  = os.path.join(tmpdir, module, 'man')
+    man1_dir = os.path.join(man_dir, 'man1')
+    for d in (bin_dir, docs_dir, html_dir, man_dir, man1_dir):
+        os.mkdir(d)
+    
     grass.message(_("Compiling '%s'...") % module)
     if grass.call(['make',
-                   'MODULE_TOPDIR=%s' % gisbase.replace(' ', '\ ')],
+                   'MODULE_TOPDIR=%s' % gisbase.replace(' ', '\ '),
+                   'BIN=%s' % bin_dir,
+                   'HTMLDIR=%s' % html_dir,
+                   'MANDIR=%s' % man1_dir],
                    stdout = outdev) != 0:
         grass.fatal(_('Compilation failed, sorry. Please check above error messages.'))
     
@@ -336,25 +345,14 @@
         return
     
     grass.message(_("Installing '%s'...") % module)
-    # replace with something better
-    file = os.path.join(prefix, 'test')
-    f = open(file, "w")
-    f.close()
-    os.remove(file)
- 
-    if not flags['s']:
-        ret = grass.call(['make',
-                          'MODULE_TOPDIR=%s' % gisbase,
-                          'INST_DIR=%s' % prefix,
-                          'install'],
-                         stdout = outdev)
-    else:
-        ret = grass.call(['sudo', 'make',
-                          'MODULE_TOPDIR=%s' % gisbase,
-                          'INST_DIR=%s' % prefix,
-                          'install'],
-                         stdout = outdev)
     
+    ret = grass.call(['make',
+                      'MODULE_TOPDIR=%s' % gisbase,
+                      'ARCH_DISTDIR=%s' % os.path.join(tmpdir, module),
+                      'INST_DIR=%s' % prefix,
+                      'install'],
+                     stdout = outdev)
+    
     if ret != 0:
         grass.warning(_('Installation failed, sorry. Please check above error messages.'))
     else:



More information about the grass-commit mailing list