Example #1
0
    def init_info(self, runtime=0):
        """Keyword arguments:

          runtime -- If false (default), the user does not need to
          link to the swig runtime (libswipy).  Newer versions of SWIG
          (>=1.3.23) do not need to build a SWIG runtime library at
          all.  In these versions of SWIG the swig_type_info is stored
          in a common module.  swig_type_info stores the type
          information and the type converters to cast pointers
          correctly.

          With earlier versions of SWIG (<1.3.22) one has to either
          link the weave module with a SWIG runtime library
          (libswigpy) in order to get the swig_type_info.  Thus, if
          `runtime` is True, the user must link to the swipy runtime
          library and in this case type checking will be performed.
          With these versions of SWIG, if runtime is `False`, no type
          checking is done.

        """
        common_base_converter.init_info(self)
        # These are generated on the fly instead of defined at
        # the class level.
        self.type_name = self.class_name
        self.c_type = self.class_name + "*"
        self.return_type = self.class_name + "*"
        self.to_c_return = None # not used
        self.check_func = None # not used

        if self.pycobj == 1:
            self.define_macros.append(("SWIG_COBJECT_TYPES", None))
            self.define_macros.append(("SWIG_COBJECT_PYTHON", None))
        elif self.pycobj == 2:
            self.define_macros.append(("SWIG_COBJECT_TYPES", None))


        if self.runtime_version is None:
            self.runtime_version = self._get_swig_runtime_version()

        rv = self.runtime_version
        if rv == 0:
            # The runtime option is only useful for older versions of
            # SWIG.
            if runtime:
                self.define_macros.append(("SWIG_NOINCLUDE", None))
            self.support_code.append(swigptr2.swigptr2_code_v0)
        elif rv == 1:
            self.support_code.append(swigptr2.swigptr2_code_v1)
        elif rv == 2:
            self.support_code.append(swigptr2.swigptr2_code_v2)
        elif rv == 3:
            self.support_code.append(swigptr2.swigptr2_code_v3)
        else:
            raise AssertionError, "Unsupported version of the SWIG runtime:", rv

        self.support_code.append(swig2_common_code)
Example #2
0
    def init_info(self, runtime=0):
        """Keyword arguments:

          runtime -- If false (default), the user does not need to
          link to the swig runtime (libswipy).  Newer versions of SWIG
          (>=1.3.23) do not need to build a SWIG runtime library at
          all.  In these versions of SWIG the swig_type_info is stored
          in a common module.  swig_type_info stores the type
          information and the type converters to cast pointers
          correctly.

          With earlier versions of SWIG (<1.3.22) one has to either
          link the weave module with a SWIG runtime library
          (libswigpy) in order to get the swig_type_info.  Thus, if
          `runtime` is True, the user must link to the swipy runtime
          library and in this case type checking will be performed.
          With these versions of SWIG, if runtime is `False`, no type
          checking is done.

        """
        common_base_converter.init_info(self)
        # These are generated on the fly instead of defined at
        # the class level.
        self.type_name = self.class_name
        self.c_type = self.class_name + "*"
        self.return_type = self.class_name + "*"
        self.to_c_return = None  # not used
        self.check_func = None  # not used

        if self.pycobj == 1:
            self.define_macros.append(("SWIG_COBJECT_TYPES", None))
            self.define_macros.append(("SWIG_COBJECT_PYTHON", None))
        elif self.pycobj == 2:
            self.define_macros.append(("SWIG_COBJECT_TYPES", None))

        if self.runtime_version is None:
            self.runtime_version = self._get_swig_runtime_version()

        rv = self.runtime_version
        if rv == 0:
            # The runtime option is only useful for older versions of
            # SWIG.
            if runtime:
                self.define_macros.append(("SWIG_NOINCLUDE", None))
            self.support_code.append(swigptr2.swigptr2_code_v0)
        elif rv == 1:
            self.support_code.append(swigptr2.swigptr2_code_v1)
        elif rv == 2:
            self.support_code.append(swigptr2.swigptr2_code_v2)
        elif rv == 3:
            self.support_code.append(swigptr2.swigptr2_code_v3)
        else:
            raise AssertionError(
                "Unsupported version of the SWIG runtime: %s" % rv)

        self.support_code.append(swig2_common_code)
 def init_info(self):
     common_base_converter.init_info(self)
     self.type_name = 'numpy'
     self.check_func = 'PyArray_Check'
     self.c_type = 'PyArrayObject*'
     self.return_type = 'PyArrayObject*'
     self.to_c_return = '(PyArrayObject*) py_obj'
     self.matching_types = [numpy.ndarray]
     self.headers = ['"numpy/arrayobject.h"', '<complex>', '<math.h>']
     self.support_code = [size_check_code, type_check_code]
     self.module_init_code = [numeric_init_code]
 def init_info(self):
     common_base_converter.init_info(self)
     self.type_name = 'numpy'
     self.check_func = 'PyArray_Check'
     self.c_type = 'PyArrayObject*'
     self.return_type = 'PyArrayObject*'
     self.to_c_return = '(PyArrayObject*) py_obj'
     self.matching_types = [numpy.ndarray]
     self.headers = ['"numpy/arrayobject.h"',
                     '<complex>','<math.h>']
     self.support_code = [size_check_code, type_check_code]
     self.module_init_code = [numeric_init_code]
Example #5
0
 def init_info(self):
     common_base_converter.init_info(self)
     # These are generated on the fly instead of defined at
     # the class level.
     self.type_name = self.class_name
     self.c_type = self.class_name + "*"
     self.return_type = self.c_type
     self.to_c_return = None  # not used
     self.check_func = None  # not used
     hdr = self.class_name + ".h"
     # Remember that you need both the quotes!
     self.headers.extend(['"vtkPythonUtil.h"', '"vtkObject.h"', '"%s"' % hdr])
     # self.include_dirs.extend(vtk_inc)
     # self.define_macros.append(('SOME_VARIABLE', '1'))
     # self.library_dirs.extend(vtk_lib)
     self.libraries.extend(["vtkCommonPython", "vtkCommon"])
Example #6
0
 def init_info(self):
     common_base_converter.init_info(self)
     # These are generated on the fly instead of defined at
     # the class level.
     self.type_name = self.class_name
     self.c_type = self.class_name + "*"
     self.return_type = self.c_type
     self.to_c_return = None  # not used
     self.check_func = None  # not used
     hdr = self.class_name + ".h"
     # Remember that you need both the quotes!
     self.headers.extend(
         ['"vtkPythonUtil.h"', '"vtkObject.h"',
          '"%s"' % hdr])
     #self.include_dirs.extend(vtk_inc)
     #self.define_macros.append(('SOME_VARIABLE', '1'))
     #self.library_dirs.extend(vtk_lib)
     self.libraries.extend(['vtkCommonPython', 'vtkCommon'])
Example #7
0
    def init_info(self):
        common_base_converter.init_info(self)
        # These are generated on the fly instead of defined at
        # the class level.
        self.type_name = self.class_name
        self.c_type = self.class_name + "*"
        self.return_type = self.class_name + "*"
        self.to_c_return = None # not used
        self.check_func = None # not used
        self.headers.append('"wx/wx.h"')
        if sys.platform == "win32":
            # These will be used in many cases
            self.headers.append('<windows.h>')

            # These are needed for linking.
            self.libraries.extend(['kernel32','user32','gdi32','comdlg32',
                                   'winspool', 'winmm', 'shell32',
                                   'oldnames', 'comctl32', 'ctl3d32',
                                   'odbc32', 'ole32', 'oleaut32',
                                   'uuid', 'rpcrt4', 'advapi32', 'wsock32'])

            # not sure which of these macros are needed.
            self.define_macros.append(('WIN32', '1'))
            self.define_macros.append(('__WIN32__', '1'))
            self.define_macros.append(('_WINDOWS', '1'))
            self.define_macros.append(('STRICT', '1'))
            # I think this will only work on NT/2000/XP set
            # set to 0x0400 for earlier versions.
            # Hmmm.  setting this breaks stuff
            #self.define_macros.append(('WINVER', '0x0350'))

            self.library_dirs.append(os.path.join(wx_base,'lib'))
            #self.include_dirs.append(os.path.join(wx_base,'include'))
            self.include_dirs.append(wx_base)
            self.include_dirs.append(os.path.join(wx_base,'include'))
            self.include_dirs.append(os.path.join(wx_base,'include','msw'))
            # how do I discover unicode or not unicode??
            # non-unicode
            self.libraries.append('wxmsw24h')
            self.include_dirs.append(os.path.join(wx_base,'lib'))

            # unicode
            #self.libraries.append('wxmswuh')
            #self.include_dirs.append(os.path.join(wx_base,'lib','mswdlluh'))
            #self.define_macros.append(('UNICODE', '1'))
        else:
            # make sure the gtk files are available
            # ?? Do I need to link to them?
            self.headers.append('"gdk/gdk.h"')
            # !! This shouldn't be hard coded.
            self.include_dirs.append("/usr/include/gtk-1.2")
            self.include_dirs.append("/usr/include/glib-1.2")
            self.include_dirs.append("/usr/lib/glib/include")
            cxxflags = get_wxconfig('cxxflags')
            libflags = get_wxconfig('libs') + get_wxconfig('gl-libs')

            #older versions of wx do not support the ldflags.
            try:
                ldflags = get_wxconfig('ldflags')
            except RuntimeError:
                ldflags = []

            self.extra_compile_args.extend(cxxflags)
            self.extra_link_args.extend(libflags)
            self.extra_link_args.extend(ldflags)
        self.support_code.append(common_info.swig_support_code)