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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 19 04:18:33 PDT 2012


Author: martinl
Date: 2012-10-19 04:18:33 -0700 (Fri, 19 Oct 2012)
New Revision: 53493

Modified:
   grass/branches/releasebranch_6_4/gui/scripts/g.extension.py
Log:
g.extension.py: sync'ed with devbr6


Modified: grass/branches/releasebranch_6_4/gui/scripts/g.extension.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/scripts/g.extension.py	2012-10-19 11:17:46 UTC (rev 53492)
+++ grass/branches/releasebranch_6_4/gui/scripts/g.extension.py	2012-10-19 11:18:33 UTC (rev 53493)
@@ -188,12 +188,7 @@
         for mnode in tree.findall('task'):
             name = mnode.get('name')
             if flags['c'] or flags['g']:
-                desc = mnode.find('description').text
-                if not desc:
-                    desc = ''
-                keyw = mnode.find('keywords').text
-                if not keyw:
-                    keyw = ''
+                desc, keyw = get_optional_params(mnode)
             
             if flags['g']:
                 print 'name=' + name
@@ -208,6 +203,22 @@
     
     return mlist
 
+def get_optional_params(mnode):
+    try:
+        desc = mnode.find('description').text
+    except AttributeError:
+        desc = ''
+    if desc is None:
+        desc = ''
+    try:
+        keyw = mnode.find('keywords').text
+    except AttributeError:
+        keyw = ''
+    if keyw is None:
+        keyw = ''
+        
+    return desc, keyw
+
 # list extensions (scan SVN repo)
 def list_available_extensions_svn():
     mlist = list()
@@ -305,6 +316,10 @@
                 indent += 4
                 for fnode in bnode.findall('file'):
                     fpath = fnode.text.split(os.path.sep)
+                    if fpath[0] == 'man' and sys.platform == 'win32':
+                        # no manual pages on MS Windows
+                        continue
+                    
                     if not flags['s']: # tidy citizen hacks
                         if fpath[0] in ('bin', 'scripts'):
                             del fpath[0]
@@ -314,6 +329,13 @@
                     fo.write('%s<file>%s</file>\n' % \
                                  (' ' * indent, os.path.join(options['prefix'],
                                                              os.path.sep.join(fpath))))
+                    
+                    if sys.platform == 'win32' and os.path.splitext(fpath[-1])[1] == '.bat':
+                        spath = fpath[:-1] + [os.path.splitext(fpath[-1])[0]]
+                        fo.write('%s<file>%s</file>\n' % \
+                                     (' ' * indent, os.path.join(options['prefix'],
+                                                                 os.path.sep.join(spath))))
+                    
                 indent -= 4 
                 fo.write('%s</binary>\n' % (' ' * indent))
             libgisRev = grass.version()['libgis_revision']
@@ -348,15 +370,10 @@
                         if path[0] == 'bin':
                             path[-1] += '.exe'
                         if path[0] == 'scripts':
-                            path[-1] += '.py'
+                            path[-1] += '.bat'
                     fList.append(os.path.sep.join(path))
             
-            desc = mnode.find('description').text
-            if not desc:
-                desc = ''
-            keyw = mnode.find('keywords').text
-            if not keyw:
-                keyw = ''
+            desc, keyw = get_optional_params(mnode)
             
             data = { 'name'  : name,
                      'desc'  : desc,
@@ -428,8 +445,9 @@
     ### TODO: do not use hardcoded url - http://wingrass.fsv.cvut.cz/grassXX/addonsX.X.X
     version = grass.version()['version'].split('.')
     grass.message(_("Downloading precompiled GRASS Addons <%s>...") % options['extension'])
-    url = "http://wingrass.fsv.cvut.cz/grass%s%s/addons/grass-%s.%s.%s" % \
-        (version[0], version[1], version[0], version[1], version[2])
+    url = "http://wingrass.fsv.cvut.cz/grass%s%s/addons" % (version[0], version[1])
+    if version[0] == '6' and version[1] == '4':
+        url += '/grass-%s.%s.%s' % (version[0], version[1], version[2])
     grass.debug("url=%s" % url, 1)
     
     try:



More information about the grass-commit mailing list