1
# IVLE - Informatics Virtual Learning Environment
2
# Copyright (C) 2007-2008 The University of Melbourne
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
# Author: Matt Giuca, Refactored by David Coles
27
from setup import util
30
usage = """usage: %prog build [options]
32
Compiles platform-specific code, and optionally Python too.
34
Compiles (GCC) bin/trampoline/trampoline.c to bin/trampoline/trampoline.
35
Compiles (GCC) bin/timount/timount.c to bin/timount/timount.
36
Optionally generates .pyc files for all the IVLE .py files."""
39
parser = optparse.OptionParser(usage)
40
parser.add_option("-n", "--dry",
41
action="store_true", dest="dry",
42
help="Print out the actions but don't do anything.")
43
parser.add_option("--no-compile",
44
action="store_true", dest="nocompile",
45
help="Don't byte-compile .py files.")
46
(options, args) = parser.parse_args(args)
48
# Call the real function
49
return __build(options.dry, options.nocompile)
51
def __build(dry=False, no_compile=None):
52
# We need to import the one in the working copy, not in the system path.
53
confmodule = __import__("ivle/conf/conf")
54
install_list = util.InstallList()
57
print "Dry run (no actions will be executed)\n"
59
# Compile the trampoline
61
os.chdir('bin/trampoline')
62
util.action_runprog('make', [], dry)
67
os.chdir('bin/timount')
68
util.action_runprog('make', [], dry)
71
# Compile .py files into .pyc or .pyo files
73
compileall.compile_dir('www', quiet=True)
74
compileall.compile_dir('ivle', quiet=True)
75
compileall.compile_dir('services', quiet=True)