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

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: mattgiuca
  • Date: 2008-02-25 01:17:22 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:560
settings: Python code generates all of the HTML for the static page.
The JavaScript makes a call to get the data but doesn't yet populate the page.

Show diffs side-by-side

added added

removed removed

Lines of Context:
159
159
    '/usr/lib/libXdmcp.so.6',
160
160
    '/lib/libgcc_s.so.1',
161
161
    '/etc/matplotlibrc',
 
162
    # Needed for resolv
 
163
    '/lib/libnss_dns.so.2',
 
164
    #'/lib/libnss_mdns4.so',
 
165
    '/etc/hosts',
 
166
    '/etc/resolv.conf',
 
167
    #'/etc/hosts.conf',
 
168
    #'/etc/hostname',
 
169
    '/etc/nsswitch.conf',
 
170
    '/lib/libnss_files.so.2',
162
171
]
163
172
# Symlinks to make within the jail. Src mapped to dst.
164
173
JAIL_LINKS = {
204
213
# In the local file system, where IVLE is actually installed.
205
214
# This directory should contain the "www" and "bin" directories."""))
206
215
config_options.append(ConfigOption("jail_base", "/home/informatics/jails",
207
 
    """Root directory where the jails (containing user files) are stored
 
216
    """Location of Directories
 
217
=======================
 
218
Root directory where the jails (containing user files) are stored
208
219
(on the local file system):""",
209
220
    """
210
221
# In the local file system, where are the student/user file spaces located.
218
229
# In the local file system, where are the per-subject file spaces located.
219
230
# The individual subject directories are expected to be located immediately
220
231
# in subdirectories of this location."""))
221
 
config_options.append(ConfigOption("problems_base",
222
 
    "/home/informatics/problems",
223
 
    """Root directory where the problem directories (containing
224
 
subject-independent problem sheets) are stored (on the local file
 
232
config_options.append(ConfigOption("exercises_base",
 
233
    "/home/informatics/exercises",
 
234
    """Root directory where the exercise directories (containing
 
235
subject-independent exercise sheets) are stored (on the local file
225
236
system):""",
226
237
    """
227
 
# In the local file system, where are the subject-independent problem sheet
 
238
# In the local file system, where are the subject-independent exercise sheet
228
239
# file spaces located."""))
229
240
config_options.append(ConfigOption("public_host", "public.localhost",
230
241
    """Hostname which will cause the server to go into "public mode",
270
281
    (Caution: This password is stored in plaintext in lib/conf/conf.py)""",
271
282
    """
272
283
# Database password"""))
 
284
config_options.append(ConfigOption("auth_modules", "ldap_auth",
 
285
    """Authentication config
 
286
=====================
 
287
Comma-separated list of authentication modules. Only "ldap" is available
 
288
by default.""",
 
289
    """
 
290
# Comma-separated list of authentication modules.
 
291
# These refer to importable Python modules in the www/auth directory.
 
292
# Modules "ldap" and "guest" are available in the source tree, but
 
293
# other modules may be plugged in to auth against organisation-specific
 
294
# auth backends."""))
 
295
config_options.append(ConfigOption("ldap_url", "ldaps://www.example.com",
 
296
    """(LDAP options are only relevant if "ldap" is included in the list of
 
297
auth modules).
 
298
URL for LDAP authentication server:""",
 
299
    """
 
300
# URL for LDAP authentication server"""))
 
301
config_options.append(ConfigOption("ldap_format_string",
 
302
    "uid=%s,ou=users,o=example",
 
303
    """Format string for LDAP auth request:
 
304
    (Must contain a single "%s" for the user's login name)""",
 
305
    """
 
306
# Format string for LDAP auth request
 
307
# (Must contain a single "%s" for the user's login name)"""))
 
308
config_options.append(ConfigOption("svn_addr", "http://svn.localhost/",
 
309
    """Subversion config
 
310
=================
 
311
The base url for accessing subversion repositories:""",
 
312
    """
 
313
# The base url for accessing subversion repositories."""))
273
314
config_options.append(ConfigOption("svn_conf", "/opt/ivle/svn/svn.conf",
274
315
    """The location of the subversion configuration file used by apache
275
316
to host the user repositories:""",
293
334
# The location of the password file used to authenticate local users
294
335
# of the subversion repository."""))
295
336
config_options.append(ConfigOption("usrmgt_host", "localhost",
296
 
    """The hostname where the usrmgt-server runs:""",
 
337
    """User Management Server config
 
338
============================
 
339
The hostname where the usrmgt-server runs:""",
297
340
    """
298
341
# The hostname where the usrmgt-server runs."""))
299
342
config_options.append(ConfigOption("usrmgt_port", "2178",
458
501
Copy subjects/ to subjects directory (unless --nosubjects specified).
459
502
 
460
503
--nojail        Do not copy the jail.
461
 
--nosubjects    Do not copy the subjects and problems directories.
 
504
--nosubjects    Do not copy the subjects and exercises directories.
462
505
--dry | -n  Print out the actions but don't do anything."""
463
506
    elif operation == 'updatejails':
464
507
        print """sudo python setup.py updatejails [--dry|-n]
477
520
    list_www = build_list_py_files('www')
478
521
    list_lib = build_list_py_files('lib')
479
522
    list_subjects = build_list_py_files('subjects', no_top_level=True)
480
 
    list_problems = build_list_py_files('problems', no_top_level=True)
 
523
    list_exercises = build_list_py_files('exercises', no_top_level=True)
481
524
    list_scripts = [
482
525
        "scripts/python-console",
483
526
        "scripts/fileservice",
519
562
list_subjects = """)
520
563
        writelist_pretty(file, list_subjects)
521
564
        file.write("""
522
 
# List of all installable files in problems directory.
 
565
# List of all installable files in exercises directory.
523
566
# This is to install sample exercise material.
524
 
list_problems = """)
525
 
        writelist_pretty(file, list_problems)
 
567
list_exercises = """)
 
568
        writelist_pretty(file, list_exercises)
526
569
 
527
570
        file.close()
528
571
    except IOError, (errno, strerror):
762
805
    action_mkdir('jail/home', dry)
763
806
    action_mkdir('jail/tmp', dry)
764
807
 
 
808
    # Chmod the tmp directory to world writable
 
809
    action_chmod_w('jail/tmp', dry)
 
810
 
765
811
    # Copy all console and operating system files into the jail
766
812
    action_copylist(install_list.list_scripts, 'jail/opt/ivle', dry)
767
813
    copy_os_files_jail(dry)
840
886
    # chown trampoline to root and set setuid bit
841
887
    action_chown_setuid(tramppath, dry)
842
888
 
 
889
    # Create a scripts directory to put the usrmgt-server in.
 
890
    action_mkdir(os.path.join(ivle_install_dir, 'scripts'), dry)
 
891
    usrmgtpath = os.path.join(ivle_install_dir, 'scripts/usrmgt-server')
 
892
    action_copyfile('scripts/usrmgt-server', usrmgtpath, dry)
 
893
    action_chmod_x(usrmgtpath, dry)
 
894
 
843
895
    # Copy the www and lib directories using the list
844
896
    action_copylist(install_list.list_www, ivle_install_dir, dry)
845
897
    action_copylist(install_list.list_lib, ivle_install_dir, dry)
 
898
    
 
899
    # Copy the php directory
 
900
    action_copytree('www/php/phpBB3',os.path.join(ivle_install_dir,'www/php/phpBB3'), 
 
901
    dry)
846
902
 
847
903
    if not nojail:
848
904
        # Copy the local jail directory built by the build action
850
906
        # for all the students' jails).
851
907
        action_copytree('jail', os.path.join(jail_base, 'template'), dry)
852
908
    if not nosubjects:
853
 
        # Copy the subjects and problems directories across
 
909
        # Copy the subjects and exercises directories across
854
910
        action_copylist(install_list.list_subjects, subjects_base, dry,
855
911
            srcdir="./subjects")
856
 
        action_copylist(install_list.list_problems, problems_base, dry,
857
 
            srcdir="./problems")
 
912
        action_copylist(install_list.list_exercises, exercises_base, dry,
 
913
            srcdir="./exercises")
858
914
 
859
915
    # Append IVLE path to ivle.pth in python site packages
860
916
    # (Unless it's already there)
984
1040
    directories as necessary.
985
1041
 
986
1042
    See shutil.copytree."""
 
1043
    # Allow copying over itself
 
1044
    if (os.path.normpath(os.path.join(os.getcwd(),src)) ==
 
1045
        os.path.normpath(os.path.join(os.getcwd(),dst))):
 
1046
        return
987
1047
    action_remove(dst, dry)
988
1048
    print "cp -r", src, dst
989
1049
    if dry: return
1074
1134
        os.chmod(file, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR
1075
1135
            | stat.S_IXGRP | stat.S_IRGRP | stat.S_IXOTH | stat.S_IROTH)
1076
1136
 
 
1137
 
 
1138
def action_chmod_w(file, dry):
 
1139
    """Chmod 777 a file (sets permissions to rwxrwxrwx)."""
 
1140
    print "chmod 777", file
 
1141
    if not dry:
 
1142
        os.chmod(file, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR
 
1143
            | stat.S_IXGRP | stat.S_IWGRP | stat.S_IRGRP | stat.S_IXOTH
 
1144
            | stat.S_IWOTH | stat.S_IROTH)
 
1145
 
1077
1146
def query_user(default, prompt):
1078
1147
    """Prompts the user for a string, which is read from a line of stdin.
1079
1148
    Exits silently if EOF is encountered. Returns the string, with spaces