Changes to work with WAF 1.5.5

This commit is contained in:
Gustavo J. A. M. Carneiro committed 2009-04-27 14:59:09 +01:00
1 parent c51d9a8d4a
commit 231bec81fe
1 file changed
+50 -49
+50 -49
View File
@@ -3,6 +3,7 @@
import Options
import Build
import Scripting
import Configure
Configure.autoconfig = True
@@ -144,11 +145,6 @@ def set_options(opt):
action="store_true", default=False,
dest='generate_version')
optgrp.add_option('--generate-api-docs',
help=('Generate API html documentation, using epydoc.'),
action="store_true", default=False,
dest='generate_api_docs')
optgrp.add_option('--examples',
help=('Compile the example programs.'),
action="store_true", default=False,
@@ -196,6 +192,8 @@ def configure(conf):
def build(bld):
global g_bld
g_bld = bld
if getattr(Options.options, 'generate_version', False):
generate_version_py(force=True)
@@ -205,62 +203,65 @@ def build(bld):
if Options.commands['check'] or Options.commands['clean']:
bld.add_subdirs('tests')
def shutdown():
if Options.commands['check']:
check_context = Build.BuildContext
def check(bld):
"run the unit tests"
Scripting.build(bld)
print "Running pure python unit tests..."
retval1 = subprocess.Popen([Build.bld.env['PYTHON'], 'tests/test.py']).wait()
print "Running pure python unit tests..."
retval1 = subprocess.Popen([Build.bld.env['PYTHON'], 'tests/test.py']).wait()
env = g_bld.env
env = Build.bld.env
if env['CXX']:
print "Running manual module generation unit tests (module foo)..."
retval2 = subprocess.Popen([env['PYTHON'], 'tests/footest.py', '1']).wait()
else:
print "Skipping manual module generation unit tests (no C/C++ compiler)..."
retval2 = 0
if env['CXX']:
print "Running manual module generation unit tests (module foo)..."
retval2 = subprocess.Popen([env['PYTHON'], 'tests/footest.py', '1']).wait()
else:
print "Skipping manual module generation unit tests (no C/C++ compiler)..."
retval2 = 0
if env['ENABLE_PYGCCXML']:
print "Running automatically scanned module generation unit tests (module foo2)..."
retval3 = subprocess.Popen([env['PYTHON'], 'tests/footest.py', '2']).wait()
if env['ENABLE_PYGCCXML']:
print "Running automatically scanned module generation unit tests (module foo2)..."
retval3 = subprocess.Popen([env['PYTHON'], 'tests/footest.py', '2']).wait()
print "Running module generated by automatically generated python script unit tests (module foo3)..."
retval3b = subprocess.Popen([env['PYTHON'], 'tests/footest.py', '3']).wait()
print "Running module generated by automatically generated python script unit tests (module foo3)..."
retval3b = subprocess.Popen([env['PYTHON'], 'tests/footest.py', '3']).wait()
print "Running module generated by generated and split python script unit tests (module foo4)..."
retval3c = subprocess.Popen([env['PYTHON'], 'tests/footest.py', '4']).wait()
print "Running module generated by generated and split python script unit tests (module foo4)..."
retval3c = subprocess.Popen([env['PYTHON'], 'tests/footest.py', '4']).wait()
print "Running semi-automatically scanned c-hello module ('hello')..."
retval4 = subprocess.Popen([env['PYTHON'], 'tests/c-hello/hellotest.py']).wait()
else:
print "Skipping automatically scanned module generation unit tests (pygccxml missing)..."
print "Skipping module generated by automatically generated python script unit tests (pygccxml missing)..."
print "Skipping module generated by generated and split python script unit tests (pygccxml missing)..."
print "Skipping semi-automatically scanned c-hello module (pygccxml missing)..."
retval3 = retval3b = retval3c = retval4 = 0
print "Running semi-automatically scanned c-hello module ('hello')..."
retval4 = subprocess.Popen([env['PYTHON'], 'tests/c-hello/hellotest.py']).wait()
else:
print "Skipping automatically scanned module generation unit tests (pygccxml missing)..."
print "Skipping module generated by automatically generated python script unit tests (pygccxml missing)..."
print "Skipping module generated by generated and split python script unit tests (pygccxml missing)..."
print "Skipping semi-automatically scanned c-hello module (pygccxml missing)..."
retval3 = retval3b = retval3c = retval4 = 0
if retval1 or retval2 or retval3 or retval3b or retval3c or retval4:
Logs.error("Unit test failures")
raise SystemExit(2)
if retval1 or retval2 or retval3 or retval3b or retval3c or retval4:
Logs.error("Unit test failures")
raise SystemExit(2)
if Options.options.generate_api_docs:
generate_version_py(force=True)
retval = subprocess.Popen(["epydoc", "-v", "--html", "--graph=all", "pybindgen",
"-o", "apidocs",
"--pstat=build/foomodulegen-auto.pstat",
def generate_api_docs(ctx):
"generate API documentation, using epydoc"
generate_version_py(force=True)
retval = subprocess.Popen(["epydoc", "-v", "--html", "--graph=all", "pybindgen",
"-o", "apidocs",
"--pstat=build/foomodulegen-auto.pstat",
"--pstat=build/foomodulegen.pstat",
"--pstat=build/hellomodulegen.pstat",
"--no-private",
]).wait()
if retval:
Logs.error("epydoc returned with code %i" % retval)
raise SystemExit(2)
"--pstat=build/hellomodulegen.pstat",
"--no-private",
]).wait()
if retval:
Logs.error("epydoc returned with code %i" % retval)
raise SystemExit(2)
# Patch the generated CSS file to highlight literal blocks (this is a copy of pre.py-doctest)
css = open("apidocs/epydoc.css", "at")
css.write("""
# Patch the generated CSS file to highlight literal blocks (this is a copy of pre.py-doctest)
css = open("apidocs/epydoc.css", "at")
css.write("""
pre.literalblock { padding: .5em; margin: 1em;
background: #e8f0f8; color: #000000;
border: 1px solid #708890; }
""")
css.close()
css.close()