[mapserver-commits] r9510 - in trunk/mapserver: . mapscript/python

svn at osgeo.org svn at osgeo.org
Sat Oct 24 23:55:11 EDT 2009


Author: hobu
Date: 2009-10-24 23:55:11 -0400 (Sat, 24 Oct 2009)
New Revision: 9510

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapscript/python/setup.py
Log:
fix #2663

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2009-10-24 04:45:32 UTC (rev 9509)
+++ trunk/mapserver/HISTORY.TXT	2009-10-25 03:55:11 UTC (rev 9510)
@@ -14,6 +14,12 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Ensure Python MapScript building doesn't reorder the libraries, support the 
+  'subprocess' module where available for setup.py, and default to using the 
+  "super" swig invocation described in the Python MapScript README when 
+  mapscript_wrap.c isn't available on the file system.  #2663 contains the 
+  reordering issue.
+
 - Fixed memory leak with shapefiles associated with one-pass query implementation (#3188)
 
 - Fix abs/fabs usage that prevented angle follow labels to be discarded if they
@@ -29,7 +35,7 @@
 
 - Added charset in content-type http header for wms/wfs/sos/wcs requests (#2583)
 
-- Python/MapScript: improve compatability for different swig versions (#3180)
+- Python/MapScript: improve compatibility for different swig versions (#3180)
 
 - maprasterquery.c: a few fixes since beta4 (#3181, #3168).
 

Modified: trunk/mapserver/mapscript/python/setup.py
===================================================================
--- trunk/mapserver/mapscript/python/setup.py	2009-10-24 04:45:32 UTC (rev 9509)
+++ trunk/mapserver/mapscript/python/setup.py	2009-10-25 03:55:11 UTC (rev 9510)
@@ -26,16 +26,24 @@
 from distutils.command.build_ext import build_ext
 from distutils.ccompiler import get_default_compiler
 from distutils.sysconfig import get_python_inc
-import popen2
 
+try:
+    import subprocess
+except ImportError:
+    import popen2
+
 # 
 # # Function needed to make unique lists.
 def unique(list):
+    ret_list = []
     dict = {}
     for item in list:
-        dict[item] = ''
-    return dict.keys()
+        if not dict.has_key(item):
+            dict[item] = ''
+            ret_list.append( item )
+    return ret_list
 
+
 # ---------------------------------------------------------------------------
 # Default build options
 # (may be overriden with setup.cfg or command line switches).
@@ -91,12 +99,18 @@
     if sys.platform == 'win32':
         v = read_mapscriptvars()
         return v[option]
-    
     command = config + " --%s" % option
-    p = popen2.popen3(command)
-    r = p[0].readline().strip()
-    if not r:
-        raise Warning(p[2].readline())
+    try:
+        subprocess
+        command, args = command.split()[0], command.split()[1]
+        p = subprocess.Popen([command, args], stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)
+        (child_stdout, child_stdin) = (p.stdout, p.stdin)
+        r = child_stdout.read().strip()
+    except NameError:
+        p = popen2.popen3(command)
+        r = p[0].readline().strip()
+        if not r:
+            raise Warning(p[2].readline())
     return r
     
 
@@ -205,7 +219,8 @@
 readme = file('README','rb').read()
 
 if not os.path.exists('mapscript_wrap.c') :
-	os.system('swig -python -shadow -modern %s -o mapscript_wrap.c ../mapscript.i' % get_config('defines'))
+    swig_cmd = """swig -python -shadow -modern -templatereduce -fastdispatch -fvirtual -fastproxy -modernargs -castmode -dirvtable -fastinit -fastquery -noproxydel -nobuildnone %s -o mapscript_wrap.c ../mapscript.i"""
+    os.system(swig_cmd % get_config('defines', config='../../mapserver-config'))
 
 classifiers = [
         'Development Status :: 4 - Beta',



More information about the mapserver-commits mailing list