97
by mattgiuca
Moved template.py and setup.py to better places. |
1 |
#!/usr/bin/env python
|
2 |
# IVLE - Informatics Virtual Learning Environment
|
|
3 |
# Copyright (C) 2007-2008 The University of Melbourne
|
|
4 |
#
|
|
5 |
# This program is free software; you can redistribute it and/or modify
|
|
6 |
# it under the terms of the GNU General Public License as published by
|
|
7 |
# the Free Software Foundation; either version 2 of the License, or
|
|
8 |
# (at your option) any later version.
|
|
9 |
#
|
|
10 |
# This program is distributed in the hope that it will be useful,
|
|
11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
# GNU General Public License for more details.
|
|
14 |
#
|
|
15 |
# You should have received a copy of the GNU General Public License
|
|
16 |
# along with this program; if not, write to the Free Software
|
|
17 |
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
||
19 |
# Module: setup
|
|
20 |
# Author: Matt Giuca
|
|
21 |
# Date: 12/12/2007
|
|
22 |
||
23 |
# This is a command-line application, for use by the administrator.
|
|
804
by dcoles
Setup: To go with last revision - Now just a front end for the setup package |
24 |
# This program is a frontend for the modules in the setup packages that
|
1092.1.48
by William Grant
Remove the setup.configure import from setup. |
25 |
# build and install IVLE in separate steps.
|
104
by mattgiuca
setup.py: Replaced the simple script with a full options processing script |
26 |
# It is called with at least one argument, which specifies which operation to
|
27 |
# take.
|
|
28 |
||
97
by mattgiuca
Moved template.py and setup.py to better places. |
29 |
import sys |
804
by dcoles
Setup: To go with last revision - Now just a front end for the setup package |
30 |
import setup.build |
31 |
import setup.install |
|
32 |
||
104
by mattgiuca
setup.py: Replaced the simple script with a full options processing script |
33 |
def main(argv=None): |
34 |
if argv is None: |
|
35 |
argv = sys.argv |
|
36 |
||
37 |
# Print the opening spiel including the GPL notice
|
|
38 |
||
39 |
print """IVLE - Informatics Virtual Learning Environment Setup |
|
1069
by matt.giuca
setup.py: Updated copyright (2009). |
40 |
Copyright (C) 2007-2009 The University of Melbourne
|
97
by mattgiuca
Moved template.py and setup.py to better places. |
41 |
IVLE comes with ABSOLUTELY NO WARRANTY.
|
42 |
This is free software, and you are welcome to redistribute it
|
|
43 |
under certain conditions. See LICENSE.txt for details.
|
|
104
by mattgiuca
setup.py: Replaced the simple script with a full options processing script |
44 |
|
45 |
IVLE Setup
|
|
46 |
"""
|
|
47 |
||
48 |
# First argument is the name of the setup operation
|
|
49 |
try: |
|
50 |
operation = argv[1] |
|
51 |
except IndexError: |
|
52 |
# Print usage message and exit
|
|
53 |
help([]) |
|
54 |
return 1 |
|
55 |
||
804
by dcoles
Setup: To go with last revision - Now just a front end for the setup package |
56 |
oper_func = call_operator(operation) |
120
by mattgiuca
setup.py: Added command-line argument mode for conf. This completely works! |
57 |
return oper_func(argv[2:]) |
104
by mattgiuca
setup.py: Replaced the simple script with a full options processing script |
58 |
|
59 |
def help(args): |
|
804
by dcoles
Setup: To go with last revision - Now just a front end for the setup package |
60 |
if len(args)!=1: |
61 |
print """Usage: python setup.py operation [options] |
|
1050
by wagrant
setup: Don't give possible options in the top-level usage string. |
62 |
Operation can be:
|
104
by mattgiuca
setup.py: Replaced the simple script with a full options processing script |
63 |
help [operation]
|
64 |
build
|
|
1050
by wagrant
setup: Don't give possible options in the top-level usage string. |
65 |
install
|
804
by dcoles
Setup: To go with last revision - Now just a front end for the setup package |
66 |
|
1050
by wagrant
setup: Don't give possible options in the top-level usage string. |
67 |
For help and options for a specific operation use 'help [operation]'."""
|
804
by dcoles
Setup: To go with last revision - Now just a front end for the setup package |
68 |
else: |
69 |
operator = args[0] |
|
70 |
oper_func = call_operator(operator) |
|
71 |
oper_func(['operator','--help']) |
|
72 |
||
73 |
def call_operator(operation): |
|
74 |
# Call the requested operation's function
|
|
75 |
try: |
|
76 |
oper_func = { |
|
77 |
'help' : help, |
|
78 |
'build' : setup.build.build, |
|
79 |
'install' : setup.install.install, |
|
80 |
}[operation] |
|
81 |
except KeyError: |
|
104
by mattgiuca
setup.py: Replaced the simple script with a full options processing script |
82 |
print >>sys.stderr, ( |
83 |
"""Invalid operation '%s'. Try python setup.py help."""
|
|
84 |
% operation) |
|
804
by dcoles
Setup: To go with last revision - Now just a front end for the setup package |
85 |
sys.exit(1) |
86 |
return oper_func |
|
746
by dcoles
Setup: During Build the system will now indicate what revision is being built |
87 |
|
104
by mattgiuca
setup.py: Replaced the simple script with a full options processing script |
88 |
if __name__ == "__main__": |
89 |
sys.exit(main()) |
|
746
by dcoles
Setup: During Build the system will now indicate what revision is being built |
90 |