Update of /cvsroot/pygccxml/source/pyplusplus/examples/py_easybmp
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6271/pyplusplus/examples/py_easybmp
Added Files:
build_setup.py generate_code.py
Log Message:
--- NEW FILE: generate_code.py ---
#! /usr/bin/python
# Copyright 2004 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import os
from environment import settings
from pyplusplus import code_creators
from pyplusplus import module_builder
license = \
"""
// Copyright 2004 Roman Yakovenko.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
"""
def export():
global license
header_file = os.path.join( settings.easybmp_path, 'EasyBMP.h' )
#create configuration for GCC-XML parser
#initialize module builder
mb = module_builder.module_builder_t( [ header_file ]
, gccxml_path=settings.gccxml_path
, working_directory=settings.easybmp_path )
bmp_class = mb.class_( 'BMP' )
call_operator = bmp_class.operator( symbol='()', recursive=False )
call_operator.alias = 'GetRGBAPixel'
call_operator.call_policies = module_builder.call_policies.return_internal_reference()
#customizing code, before generation
mb.build_code_creator( settings.module_name )
mb.code_creator.license = license
mb.code_creator.user_defined_directories.append( settings.easybmp_path )
mb.code_creator.precompiled_header = 'boost/python.hpp'
mb.code_creator.adopt_creator( code_creators.include_t( header=header_file ), 2 )
mb.write_module( os.path.join( settings.generated_files_dir, settings.module_name + '.cpp') )
if __name__ == '__main__':
export()
print 'done'
--- NEW FILE: build_setup.py ---
#! /usr/bin/python
# Copyright 2004 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import os
import sys
import shutil
def create( source_dir, target_dir ):
sys.path.append( source_dir )
environment = __import__( 'environment' )
files_dir = os.path.join( source_dir, 'unittests' )
files = ['grayscale.py', 'source.bmp', 'target.bmp', 'LICENSE_1_0.txt' ]
if 'win32' == sys.platform:
files.append( 'pyeasybmp.pyd' )
else:
files.append( 'pyeasybmp.so' )
files = map( lambda fname: os.path.join( files_dir, fname ), files )
if 'win32' == sys.platform:
files.append( os.path.join( environment.settings.boost_libs_path, 'boost_python.dll' ) )
else:
files.append( os.path.join( environment.settings.boost_libs_path, 'libboost_python.so' ) )
files.append( os.path.join( environment.settings.boost_libs_path, 'libboost_python.so.1.33.1' ) )
for f in files:
shutil.copy( f, target_dir )
|