wscript 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. # Gustavo Carneiro, 2007
  4. import sys
  5. VERSION='0.0.1'
  6. APPNAME='python_test'
  7. top = '.'
  8. out = 'build'
  9. def options(opt):
  10. opt.load('python') # options for disabling pyc or pyo compilation
  11. opt.load('compiler_c')
  12. def configure(conf):
  13. conf.load('compiler_c')
  14. conf.load('python')
  15. conf.check_python_version((2,4,2))
  16. conf.check_python_headers()
  17. conf.check_python_module('os')
  18. conf.check_python_module('re', condition="ver > num(2,0,4) and ver <= num(2,3,0)")
  19. try:
  20. conf.check_python_module('pygccxml')
  21. except conf.errors.ConfigurationError:
  22. print('could not find pygccxml (ignored)')
  23. def build(bld):
  24. # first compile a few pyc and pyo files (set install_path=None to disable the installation,
  25. # by default install_path is set to ${PYTHONDIR})
  26. bld(features='py', source=bld.path.ant_glob('*.py'), install_from='.')
  27. # example for generated python files
  28. target = bld.path.find_or_declare('abc.py')
  29. bld(rule='touch ${TGT}', source='wscript', target=target)
  30. bld(features='py', source=[target], install_from=target.parent)
  31. # then a c extension module
  32. bld(
  33. features = 'c cshlib pyext',
  34. source = 'spammodule.c',
  35. target = 'spam')
  36. # then a c program
  37. bld(
  38. features = 'c cprogram pyembed',
  39. source = 'test.c',
  40. target = 'test')