pyplusplus

Package pyplusplus |

# Source Code for Package pyplusplus

     1  # Copyright 2004-2008 Roman Yakovenko.
     2  # Distributed under the Boost Software License, Version 1.0. (See
     3  # accompanying file LICENSE_1_0.txt or copy at
     4  # http://www.boost.org/LICENSE_1_0.txt)
     5
     6  """Py++ - Boost.Python code generator
     7  ========================================
     8
     9  This package (together with the accompanying pygccxml package and
    10  U{Boost.Python<http://www.boost.org/libs/python/doc/index.html>})
    11  assists you in creating Python bindings for a C/C++ library. This is
    12  done by parsing a set of header files that contain all the
    13  stuff you want to expose in Python. The result of this parsing
    14  step is a I{declaration tree} that represents all declarations found
    15  in the headers. You can then modify (decorate) this tree to customize
    16  the bindings. After that, a I{code creators} tree is created where
    17  each node represents a block of C++ source code. So you can change any piece of
    18  code befor it is written to disk. As a last step, these source code blocks are
    19  finally written into one or more C++ source files, which can then be compiled to
    20  generate the final Python module.
    21
    22  If you are just starting with U{Py++<http://www.language-binding.net>},
    23  then consider to read documentation of L{module_builder} package.
    24  """
    25
    26  import code_creators
    27  import file_writers
    28  import module_creator
    29  import code_repository
    30  import utils
    31  import decl_wrappers
    32  import module_builder
    33  import messages
    34
    35  from _logging_ import multi_line_formatter_t
    36
    37  __version__ = '1.0.0'
    38
    39  import pygccxml
    40  if not hasattr( pygccxml, '__revision__' ) or pygccxml.__revision__ < 1080:
    41      msg = 'This revision of Py++ requieres pygccxml revision to be ' \
    42            'greater or equal to %d. ' \
    43            'Please install right pygccxml version.'
    44      raise AssertionError( msg % pygccxml.__revision__ )
    45
    46  #Known issues:
    47  #3.
    48  #~ > > 2. An other difference: when Py++ creates bindings for a set of
    49  #~ > > declarations, it
    50  #~ > > should (?) see all declarations that are going to be exported:
    51  #~ > >     reasons:
    52  #~ > >         to decide what class holder is.
    53  #~ > >             In one header file you define class, in an other you
    54  #~ > > define function that takes
    55  #~ > >             as argument shared_ptr to the class.
    56  #~ >
    57  #~ > You don't need to use a shared_ptr holder for that purpose.  The
    58  #~ > *only* reason you'd ever want to use a share_ptr holder is if you
    59  #~ > expect people to wrap functions taking non-const references to these
    60  #~ > shared_ptrs.  That is very rare -- it only happens when users want to
    61  #~ > replace one shared_ptr with another (possibly NULL) shared_ptr.
    62