~azzar1/unity/add-show-desktop-key

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 
25
# configure, build and install IVLE in three 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.configure
31
import setup.build
32
import setup.install
33
import setup.listmake
34
104 by mattgiuca
setup.py: Replaced the simple script with a full options processing script
35
36
def main(argv=None):
37
    if argv is None:
38
        argv = sys.argv
39
40
    # Print the opening spiel including the GPL notice
41
42
    print """IVLE - Informatics Virtual Learning Environment Setup
97 by mattgiuca
Moved template.py and setup.py to better places.
43
Copyright (C) 2007-2008 The University of Melbourne
44
IVLE comes with ABSOLUTELY NO WARRANTY.
45
This is free software, and you are welcome to redistribute it
46
under certain conditions. See LICENSE.txt for details.
104 by mattgiuca
setup.py: Replaced the simple script with a full options processing script
47
48
IVLE Setup
49
"""
50
51
    # First argument is the name of the setup operation
52
    try:
53
        operation = argv[1]
54
    except IndexError:
55
        # Print usage message and exit
56
        help([])
57
        return 1
58
804 by dcoles
Setup: To go with last revision - Now just a front end for the setup package
59
    oper_func = call_operator(operation)
120 by mattgiuca
setup.py: Added command-line argument mode for conf. This completely works!
60
    return oper_func(argv[2:])
104 by mattgiuca
setup.py: Replaced the simple script with a full options processing script
61
62
def help(args):
804 by dcoles
Setup: To go with last revision - Now just a front end for the setup package
63
    if len(args)!=1:
64
        print """Usage: python setup.py operation [options]
65
Operation (and options) can be:
104 by mattgiuca
setup.py: Replaced the simple script with a full options processing script
66
    help [operation]
131 by mattgiuca
setup.py:
67
    listmake (developer use only)
316 by drtomc
setup.py - name the configuration command "config" to bring it into line with
68
    config [args]
104 by mattgiuca
setup.py: Replaced the simple script with a full options processing script
69
    build
313 by mattgiuca
test/test_framework: Updated examples, a bit of better descriptions, sample
70
    install [--nojail] [--nosubjects] [-n|--dry]
804 by dcoles
Setup: To go with last revision - Now just a front end for the setup package
71
72
    For help on a specific operation use 'help [operation]'."""
73
    else:
74
        operator = args[0]
75
        oper_func = call_operator(operator)
76
        oper_func(['operator','--help'])
77
78
def call_operator(operation):
79
    # Call the requested operation's function
80
    try:
81
        oper_func = {
82
            'help' : help,
83
            'config' : setup.configure.configure,
84
            'build' : setup.build.build,
85
            'listmake' : setup.listmake.listmake,
86
            'install' : setup.install.install,
87
            #'updatejails' : None,
88
        }[operation]
89
    except KeyError:
104 by mattgiuca
setup.py: Replaced the simple script with a full options processing script
90
        print >>sys.stderr, (
91
            """Invalid operation '%s'. Try python setup.py help."""
92
            % operation)
804 by dcoles
Setup: To go with last revision - Now just a front end for the setup package
93
        sys.exit(1)
94
    return oper_func
746 by dcoles
Setup: During Build the system will now indicate what revision is being built
95
104 by mattgiuca
setup.py: Replaced the simple script with a full options processing script
96
if __name__ == "__main__":
97
    sys.exit(main())
746 by dcoles
Setup: During Build the system will now indicate what revision is being built
98