[Mapserver-users] Can't build python mapscript

Sean Gillies sgillies at frii.com
Thu Jun 12 11:39:35 EDT 2003


--Apple-Mail-3--184235664
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed


On Thursday, June 12, 2003, at 01:13  AM, Michael Schulz wrote:

> Hi
> Sean, i tried the built on the linux box where i encountered exactly 
> the
> same error as Vic described but even with your mapscript_wrap.c the 
> error
> remains.
>
> We have built python-mapscript from a recent nightly successfully on
> another machine with exactly the same mapserver source packages, SWIG
> 1.3.19, python 2.1.3 the only difference we have is the gcc version, 
> 2.95
> on the machine that doesn't build, 3.2 on the machine that builds 
> python
> mapscript.
>
> Vic what packages are you using?
>
> Cheers, Michael
>
>
I've done a bit of investigating this morning and find that my own
distutils setup script works fine.  Am attaching it.  You will need
to edit libraries and their paths to work with your system.

Sean


--
Sean Gillies
sgillies at frii dot com
http://www.frii.com/~sgillies

--Apple-Mail-3--184235664
Content-Disposition: attachment;
	filename=my_setup.py
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0755;
	name="my_setup.py"

from distutils.core import setup, Extension
from distutils.spawn import spawn
from distutils.dir_util import mkpath
from distutils.file_util import copy_file
from distutils.sysconfig import parse_makefile

import os
from os import path
import re

wrapper = 'my_mapscript_wrap.c'
wrapper_wnone = 'my_mapscript_wrap_wnone.c'

noisy=1
swig_cmd = ["swig",
            "-python",
            "-shadow",
            "-DUSE_GD_PNG",
            "-DUSE_GD_JPEG",
            "-DUSE_PROJ",
            "-module",
            "mapscript",
            "-o",
            wrapper,
            "../mapscript.i" ]
            
spawn(swig_cmd, verbose=noisy)

# Filter the wrapper code using re.sub()
fh = open(wrapper, 'rb')
wrapper_code = fh.read()
fh.close()
wrapper_wnone_code = re.sub(r'"Os:(\w+)_set"', r'"Oz:\1_set"', wrapper_code)
fh = open(wrapper_wnone, 'wb')
fh.write(wrapper_wnone_code)
fh.close()

# make package directory and package __init__ script
mkpath("mapscript")
init_file=open(path.join("mapscript","__init__.py"),"w")
init_file.write("from mapscript import *\n")
init_file.close()

copy_file("mapscript.py", path.join("mapscript","mapscript.py"), verbose=noisy)

# change to reflect the gd version you are using
ms_dir='../..'
gdal_dir = '/usr/local/src/gdal-1.1.8'
local_dir="/usr/local"

msmod = Extension(
    '_mapscript', [wrapper_wnone],
    define_macros = [('USE_GD_PNG', None), 
                     ('USE_GD_JPEG', None),
		     ('USE_GD_WBMP', None),
		     ('USE_PROJ', None),
		     ('USE_PROJ_API_H', None),
             ('PROJ_STATIC', None),
		     ('IGNORE_MISSING_DATA', None)],
    extra_objects=[path.join(ms_dir, 'libmap.a'),
    '/usr/local/src/gdal-1.1.8/ogr//ogrsf_frmts/ogrsf_frmts.a',
    '/usr/local/src/gdal-1.1.8/ogr//ogr.a',
    '/usr/local/src/gdal-1.1.8/ogr//../port/cpl.a',
    path.join(gdal_dir, 'gdal.a')],
    library_dirs=['/usr/X11R6/lib'],
    libraries=['stdc++', 'gd','png','jpeg','freetype','z','proj','curl'])
setup (# Distribution meta-data
       name = "pymapscript",
       version = "3.7 Development",
       description = "pre release",
       author = "Steve Lime",
       author_email = "steve.lime at dnr.state.mn.us",
       url = "http://mapserver.gis.umn.edu/",

       # Description of the modules and packages in the distribution
       packages = ['mapscript'],
       ext_modules = [msmod])


--Apple-Mail-3--184235664--




More information about the mapserver-users mailing list