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

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: matt.giuca
  • Date: 2009-01-14 10:10:12 UTC
  • mto: This revision was merged to the branch mainline in revision 1090.
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:branches%2Fstorm:1132
The new ivle.database.User class is now used in Request and usrmgt, which
    means it is now almost universally used in favour of ivle.user.User (now
    deprecated).

Noticeable change: The minor bug where the change to a user object in the
    database is not reflected in the user's session (eg. changing nick doesn't
    update title until log out).

ivle.dispatch:
    Session now contains 'login' (username string) rather than 'user' (full
        ivle.user.User object). This is a unicode string now.

    req.user is now a ivle.database.User object rather than an ivle.user.User
        object. This makes for a whole lot of really subtle differences, but
        largely conforms to the same interface. Note that strings must now all
        be unicode.

    login: Removed use of ivle.db. Now uses User object.

    html: Now handles unicode login and config options.

ivle.db: Removed update_user. Now replaced with Storm model.

ivle.database: Renamed has_cap back to hasCap (saved for later). Fixed small
    unicode bug.

ivle.makeuser.make_svn_auth now takes a store object.

usrmgt-server: Use new User class.

userservice: Now uses User class internally.
    get_user action now returns ISO 8601 date format, rather than a
        time tuple. (Wasn't being used).
    get_user action no longer transmits local_password (small security risk;
        note that it wasn't possible to see this for any user other than
        yourself unless admin).

ivle.util - added function object_to_dict.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.
 
24
# This program is a frontend for the modules in the setup packages that 
 
25
# configure, build and install IVLE in three separate steps.
 
26
# It is called with at least one argument, which specifies which operation to
 
27
# take.
 
28
 
 
29
import sys
 
30
import setup.configure
 
31
import setup.build
 
32
import setup.install
 
33
 
 
34
 
 
35
def main(argv=None):
 
36
    if argv is None:
 
37
        argv = sys.argv
 
38
 
 
39
    # Print the opening spiel including the GPL notice
 
40
 
 
41
    print """IVLE - Informatics Virtual Learning Environment Setup
 
42
Copyright (C) 2007-2009 The University of Melbourne
 
43
IVLE comes with ABSOLUTELY NO WARRANTY.
 
44
This is free software, and you are welcome to redistribute it
 
45
under certain conditions. See LICENSE.txt for details.
 
46
 
 
47
IVLE Setup
 
48
"""
 
49
 
 
50
    # First argument is the name of the setup operation
 
51
    try:
 
52
        operation = argv[1]
 
53
    except IndexError:
 
54
        # Print usage message and exit
 
55
        help([])
 
56
        return 1
 
57
 
 
58
    oper_func = call_operator(operation)
 
59
    return oper_func(argv[2:])
 
60
 
 
61
def help(args):
 
62
    if len(args)!=1:
 
63
        print """Usage: python setup.py operation [options]
 
64
Operation can be:
 
65
    help [operation]
 
66
    config
 
67
    build
 
68
    install
 
69
 
 
70
    For help and options for a specific operation use 'help [operation]'."""
 
71
    else:
 
72
        operator = args[0]
 
73
        oper_func = call_operator(operator)
 
74
        oper_func(['operator','--help'])
 
75
 
 
76
def call_operator(operation):
 
77
    # Call the requested operation's function
 
78
    try:
 
79
        oper_func = {
 
80
            'help' : help,
 
81
            'config' : setup.configure.configure,
 
82
            'build' : setup.build.build,
 
83
            'install' : setup.install.install,
 
84
            #'updatejails' : None,
 
85
        }[operation]
 
86
    except KeyError:
 
87
        print >>sys.stderr, (
 
88
            """Invalid operation '%s'. Try python setup.py help."""
 
89
            % operation)
 
90
        sys.exit(1)
 
91
    return oper_func
 
92
 
 
93
if __name__ == "__main__":
 
94
    sys.exit(main())
 
95