1 |
|
2 |
# Copyright 2006 by ACcESS MNRF |
3 |
# |
4 |
# http://www.access.edu.au |
5 |
# Primary Business: Queensland, Australia |
6 |
# Licensed under the Open Software License version 3.0 |
7 |
# http://www.opensource.org/licenses/osl-3.0.php |
8 |
# |
9 |
|
10 |
|
11 |
# Extensions to Scons |
12 |
|
13 |
import py_compile |
14 |
import sys |
15 |
import os |
16 |
|
17 |
# Code to build .pyc from .py |
18 |
def build_py(target, source, env): |
19 |
py_compile.compile(str(source[0]), str(target[0])) |
20 |
return None |
21 |
|
22 |
# Code to run unit_test executables |
23 |
def runUnitTest(target, source, env): |
24 |
app = str(source[0].abspath) |
25 |
if not env.Execute(app): |
26 |
open(str(target[0]),'w').write("PASSED\n") |
27 |
else: |
28 |
return 1 |
29 |
return None |
30 |
|
31 |
def runPyUnitTest(target, source, env): |
32 |
app = 'python '+str(source[0].abspath) |
33 |
if not env.Execute(app): |
34 |
open(str(target[0]),'w').write("PASSED\n") |
35 |
else: |
36 |
return 1 |
37 |
return None |
38 |
|
39 |
|
40 |
def build_epydoc(target, source, env): |
41 |
# get where I am currently, just as a reference |
42 |
pwd = os.getcwd() |
43 |
|
44 |
# get the full path of the runepydoc script |
45 |
runepydoc = str(source[0].abspath) |
46 |
|
47 |
# use this path to work out where the doc directory is |
48 |
dirs = runepydoc.split('/') |
49 |
dirs = dirs[:-3] # trim the last two entries: this is now the doc dir path |
50 |
docdir = '/'.join(dirs) # this is the backwards python way to do it |
51 |
# (I'm feeling in a perl mood today...) |
52 |
|
53 |
# change into the relevant dir |
54 |
os.chdir(docdir) |
55 |
|
56 |
# run the epydoc script |
57 |
if not os.system(runepydoc): |
58 |
os.chdir(pwd) |
59 |
open(str(target[0]), 'w').write("Documentation built\n") |
60 |
else: |
61 |
return 1 |
62 |
return None |
63 |
|
64 |
# build doxygen docs |
65 |
def build_doxygen(target, source, env): |
66 |
# get where I am currently, just as a reference |
67 |
pwd = os.getcwd() |
68 |
|
69 |
# get the full path of the rundoxygen script |
70 |
rundoxygen = str(source[0].abspath) |
71 |
|
72 |
# use this path to work out where the doc directory is |
73 |
dirs = rundoxygen.split('/') |
74 |
dirs = dirs[:-2] # trim the last two entries: this is now the doc dir path |
75 |
docdir = '/'.join(dirs) # this is the backwards python way to do it |
76 |
# (I'm feeling in a perl mood today...) |
77 |
|
78 |
# change into the relevant dir |
79 |
os.chdir(docdir) |
80 |
|
81 |
# run the doxygen script |
82 |
if not os.system(rundoxygen): |
83 |
os.chdir(pwd) |
84 |
open(str(target[0]), 'w').write("Documentation built\n") |
85 |
else: |
86 |
return 1 |
87 |
return None |