waf/demos/python/wscript

69 lines
1.8 KiB
Plaintext
Raw Permalink Normal View History

2011-09-10 11:13:51 +02:00
#! /usr/bin/env python
# encoding: utf-8
# Gustavo Carneiro, 2007
import sys
VERSION='0.0.1'
APPNAME='python_test'
top = '.'
out = 'build'
def options(opt):
opt.load('python') # options for disabling pyc or pyo compilation
opt.load('compiler_c')
def configure(conf):
conf.load('compiler_c')
conf.load('python')
conf.check_python_version((2,4,2))
conf.check_python_headers()
2012-01-14 16:35:33 +01:00
conf.check_python_module('os')
conf.check_python_module('re', condition="ver > num(2,0,4) and ver <= num(2,3,0)")
2011-09-10 11:13:51 +02:00
try:
conf.check_python_module('pygccxml')
except conf.errors.ConfigurationError:
print('could not find pygccxml (ignored)')
def build(bld):
2016-08-19 20:20:13 +02:00
# first compile a few pyc and pyo files (set install_path=None to disable the installation,
# by default install_path is set to ${PYTHONDIR})
2011-09-10 11:13:51 +02:00
bld(features='py', source=bld.path.ant_glob('*.py'), install_from='.')
2016-11-06 12:10:39 +01:00
# example for generated python files
target = bld.path.find_or_declare('abc.py')
bld(rule='touch ${TGT}', source='wscript', target=target)
2017-01-21 12:50:52 +01:00
bld(features='py', source=[target], install_from=target.parent)
2016-11-06 12:10:39 +01:00
2011-09-10 11:13:51 +02:00
# then a c extension module
bld(
features = 'c cshlib pyext',
source = 'spammodule.c',
target = 'spam')
# then a c program
bld(
features = 'c cprogram pyembed',
source = 'test.c',
target = 'test')
# Install files keeping their directory structure (default: relative_trick=True)
#
2019-08-14 22:20:01 +02:00
# This will create:
# * lib/python2.7/site-packages/nested_scripts/foo/nested_foo.py
bld(features='py',
2019-08-14 22:20:01 +02:00
source=bld.path.ant_glob('nested_scripts/foo/*.py'),
install_from='.')
# Install files flatting the directory structure (relative_trick=False)
#
2019-08-14 22:20:01 +02:00
# This will create:
# * lib/python2.7/site-packages/nested_bar.py
bld(features='py',
2019-08-14 22:20:01 +02:00
source=bld.path.ant_glob('nested_scripts/bar/*.py'),
relative_trick=False,
install_from='.')