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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed May 29 09:30:59 PDT 2013


Author: zarch
Date: 2013-05-29 09:30:59 -0700 (Wed, 29 May 2013)
New Revision: 56487

Modified:
   grass/trunk/scripts/g.extension/g.extension.py
Log:
Union of different proxy parameters in one using the following syntax: proxy=http=<value>,ftp=<value>

Modified: grass/trunk/scripts/g.extension/g.extension.py
===================================================================
--- grass/trunk/scripts/g.extension/g.extension.py	2013-05-29 16:14:51 UTC (rev 56486)
+++ grass/trunk/scripts/g.extension/g.extension.py	2013-05-29 16:30:59 UTC (rev 56487)
@@ -56,26 +56,13 @@
 #% required: no
 #%end
 #%option
-#% key: http_proxy
+#% key: proxy
 #% type: string
-#% key_desc: http proxy
-#% description: Set the http proxy
+#% key_desc: proxy
+#% description: Set the proxy with: "http=<value>,ftp=<value>"
 #% required: no
+#% multiple: yes
 #%end
-#%option
-#% key: https_proxy
-#% type: string
-#% key_desc: https proxy
-#% description: Set the https proxy
-#% required: no
-#%end
-#%option
-#% key: ftp_proxy
-#% type: string
-#% key_desc: ftp proxy
-#% description: Set the ftp proxy
-#% required: no
-#%end
 
 #%flag
 #% key: l
@@ -1014,6 +1001,7 @@
     else:
         f.close()
 
+
 def main():
     # check dependecies
     if sys.platform != "win32":
@@ -1021,17 +1009,10 @@
 
     # manage proxies
     global PROXIES
-    proxy_opts = [options['http_proxy'],
-                  options['https_proxy'],
-                  options['ftp_proxy']]
-    if any(proxy_opts):
+    if options['proxy']:
         PROXIES = {}
-    if options['http_proxy']:
-        PROXIES['http'] = options['http_proxy']
-    if options['https_proxy']:
-        PROXIES['https'] = options['https_proxy']
-    if options['ftp_proxy']:
-        PROXIES['ftp'] = options['ftp_proxy']
+        for ptype, purl in (p.split('=') for p in options['proxy'].split(',')):
+            PROXIES[ptype] = purl
 
     # define path
     if flags['s']:



More information about the grass-commit mailing list