[GRASS-SVN] r49731 - grass/branches/releasebranch_6_4/gui/scripts

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Dec 14 02:56:47 EST 2011


Author: hamish
Date: 2011-12-13 23:56:46 -0800 (Tue, 13 Dec 2011)
New Revision: 49731

Modified:
   grass/branches/releasebranch_6_4/gui/scripts/g.extension.py
Log:
backport win32 dir tidying patch from devbr6

Modified: grass/branches/releasebranch_6_4/gui/scripts/g.extension.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/scripts/g.extension.py	2011-12-14 07:49:03 UTC (rev 49730)
+++ grass/branches/releasebranch_6_4/gui/scripts/g.extension.py	2011-12-14 07:56:46 UTC (rev 49731)
@@ -95,6 +95,7 @@
 import zipfile
 import tempfile
 import shutil
+import fileinput
 
 from urllib2 import urlopen, HTTPError
 
@@ -422,14 +423,18 @@
     if os.path.exists(os.path.join(options['prefix'], 'bin', options['extension']) + EXT_BIN):
         shutil.move(os.path.join(options['prefix'], 'bin', options['extension']) + EXT_BIN,
                     os.path.join(options['prefix'], options['extension']) + EXT_BIN)
-    if sys.platform == 'win32':
-        if os.path.exists(os.path.join(options['prefix'], 'bin', options['extension']) + EXT_SCT):
-            shutil.move(os.path.join(options['prefix'], 'bin', options['extension']) + EXT_SCT,
-                        os.path.join(options['prefix'], options['extension']) + EXT_SCT)
-    else:
-        if os.path.exists(os.path.join(options['prefix'], 'scripts', options['extension'])):
-            shutil.move(os.path.join(options['prefix'], 'scripts', options['extension']),
-                        os.path.join(options['prefix'], options['extension']))
+    if os.path.exists(os.path.join(options['prefix'], 'scripts', options['extension'])):
+        shutil.move(os.path.join(options['prefix'], 'scripts', options['extension']),
+                    os.path.join(options['prefix'], options['extension']))
+    if sys.platform == 'win32' and \
+            os.path.exists(os.path.join(options['prefix'], 'bin', options['extension']) + EXT_SCT):
+        shutil.move(os.path.join(options['prefix'], 'bin', options['extension']) + EXT_SCT,
+                    os.path.join(options['prefix'], options['extension']) + EXT_SCT)
+        # fix script path
+        for line in fileinput.FileInput(os.path.join(options['prefix'], options['extension']) + EXT_SCT,
+                                        inplace = True):
+            line = line.replace("%GISBASE%/scripts", "%GRASS_ADDON_PATH%")
+            print line
     
     # move man/ into docs/
     if os.path.exists(os.path.join(options['prefix'], 'man', 'man1', options['extension'] + '.1')):



More information about the grass-commit mailing list