wscript (1833B)
1 #! /usr/bin/env python 2 # encoding: utf-8 3 # Gustavo Carneiro, 2007 4 5 import sys 6 7 VERSION='0.0.1' 8 APPNAME='python_test' 9 10 top = '.' 11 out = 'build' 12 13 def options(opt): 14 opt.load('python') # options for disabling pyc or pyo compilation 15 opt.load('compiler_c') 16 17 def configure(conf): 18 conf.load('compiler_c') 19 conf.load('python') 20 conf.check_python_version((2,4,2)) 21 conf.check_python_headers() 22 23 conf.check_python_module('os') 24 conf.check_python_module('re', condition="ver > num(2,0,4) and ver <= num(2,3,0)") 25 try: 26 conf.check_python_module('pygccxml') 27 except conf.errors.ConfigurationError: 28 print('could not find pygccxml (ignored)') 29 30 def build(bld): 31 32 # first compile a few pyc and pyo files (set install_path=None to disable the installation, 33 # by default install_path is set to ${PYTHONDIR}) 34 bld(features='py', source=bld.path.ant_glob('*.py'), install_from='.') 35 36 # example for generated python files 37 target = bld.path.find_or_declare('abc.py') 38 bld(rule='touch ${TGT}', source='wscript', target=target) 39 bld(features='py', source=[target], install_from=target.parent) 40 41 # then a c extension module 42 bld( 43 features = 'c cshlib pyext', 44 source = 'spammodule.c', 45 target = 'spam') 46 47 # then a c program 48 bld( 49 features = 'c cprogram pyembed', 50 source = 'test.c', 51 target = 'test') 52 53 # Install files keeping their directory structure (default: relative_trick=True) 54 # 55 # This will create: 56 # * lib/python2.7/site-packages/nested_scripts/foo/nested_foo.py 57 bld(features='py', 58 source=bld.path.ant_glob('nested_scripts/foo/*.py'), 59 install_from='.') 60 61 # Install files flatting the directory structure (relative_trick=False) 62 # 63 # This will create: 64 # * lib/python2.7/site-packages/nested_bar.py 65 bld(features='py', 66 source=bld.path.ant_glob('nested_scripts/bar/*.py'), 67 relative_trick=False, 68 install_from='.')