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

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: mattgiuca
  • Date: 2008-02-24 22:09:16 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:553
Added new app: Settings (UI for userservice).
    (Added app dir, media dir with empty JS file, icon).
apps/__init__.py: Added error message.
dispatch/__init__.py: Added error message.
dispatch/html.py: Added link to Settings at the top
    (a special app).
    Fixed HTML icons (correct size link).
    Catch keyerror on icon which would otherwise be thrown all
    the way up on certain errors.

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"""))
273
 
 
 
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."""))
274
295
config_options.append(ConfigOption("ldap_url", "ldaps://www.example.com",
275
 
    """URL for LDAP authentication server:""",
 
296
    """(LDAP options are only relevant if "ldap" is included in the list of
 
297
auth modules).
 
298
URL for LDAP authentication server:""",
276
299
    """
277
300
# URL for LDAP authentication server"""))
278
301
config_options.append(ConfigOption("ldap_format_string",
282
305
    """
283
306
# Format string for LDAP auth request
284
307
# (Must contain a single "%s" for the user's login name)"""))
285
 
 
 
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."""))
286
314
config_options.append(ConfigOption("svn_conf", "/opt/ivle/svn/svn.conf",
287
315
    """The location of the subversion configuration file used by apache
288
316
to host the user repositories:""",
306
334
# The location of the password file used to authenticate local users
307
335
# of the subversion repository."""))
308
336
config_options.append(ConfigOption("usrmgt_host", "localhost",
309
 
    """The hostname where the usrmgt-server runs:""",
 
337
    """User Management Server config
 
338
============================
 
339
The hostname where the usrmgt-server runs:""",
310
340
    """
311
341
# The hostname where the usrmgt-server runs."""))
312
342
config_options.append(ConfigOption("usrmgt_port", "2178",
471
501
Copy subjects/ to subjects directory (unless --nosubjects specified).
472
502
 
473
503
--nojail        Do not copy the jail.
474
 
--nosubjects    Do not copy the subjects and problems directories.
 
504
--nosubjects    Do not copy the subjects and exercises directories.
475
505
--dry | -n  Print out the actions but don't do anything."""
476
506
    elif operation == 'updatejails':
477
507
        print """sudo python setup.py updatejails [--dry|-n]
490
520
    list_www = build_list_py_files('www')
491
521
    list_lib = build_list_py_files('lib')
492
522
    list_subjects = build_list_py_files('subjects', no_top_level=True)
493
 
    list_problems = build_list_py_files('problems', no_top_level=True)
 
523
    list_exercises = build_list_py_files('exercises', no_top_level=True)
494
524
    list_scripts = [
495
525
        "scripts/python-console",
496
526
        "scripts/fileservice",
532
562
list_subjects = """)
533
563
        writelist_pretty(file, list_subjects)
534
564
        file.write("""
535
 
# List of all installable files in problems directory.
 
565
# List of all installable files in exercises directory.
536
566
# This is to install sample exercise material.
537
 
list_problems = """)
538
 
        writelist_pretty(file, list_problems)
 
567
list_exercises = """)
 
568
        writelist_pretty(file, list_exercises)
539
569
 
540
570
        file.close()
541
571
    except IOError, (errno, strerror):
775
805
    action_mkdir('jail/home', dry)
776
806
    action_mkdir('jail/tmp', dry)
777
807
 
 
808
    # Chmod the tmp directory to world writable
 
809
    action_chmod_w('jail/tmp', dry)
 
810
 
778
811
    # Copy all console and operating system files into the jail
779
812
    action_copylist(install_list.list_scripts, 'jail/opt/ivle', dry)
780
813
    copy_os_files_jail(dry)
853
886
    # chown trampoline to root and set setuid bit
854
887
    action_chown_setuid(tramppath, dry)
855
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
 
856
895
    # Copy the www and lib directories using the list
857
896
    action_copylist(install_list.list_www, ivle_install_dir, dry)
858
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)
859
902
 
860
903
    if not nojail:
861
904
        # Copy the local jail directory built by the build action
863
906
        # for all the students' jails).
864
907
        action_copytree('jail', os.path.join(jail_base, 'template'), dry)
865
908
    if not nosubjects:
866
 
        # Copy the subjects and problems directories across
 
909
        # Copy the subjects and exercises directories across
867
910
        action_copylist(install_list.list_subjects, subjects_base, dry,
868
911
            srcdir="./subjects")
869
 
        action_copylist(install_list.list_problems, problems_base, dry,
870
 
            srcdir="./problems")
 
912
        action_copylist(install_list.list_exercises, exercises_base, dry,
 
913
            srcdir="./exercises")
871
914
 
872
915
    # Append IVLE path to ivle.pth in python site packages
873
916
    # (Unless it's already there)
997
1040
    directories as necessary.
998
1041
 
999
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
1000
1047
    action_remove(dst, dry)
1001
1048
    print "cp -r", src, dst
1002
1049
    if dry: return
1087
1134
        os.chmod(file, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR
1088
1135
            | stat.S_IXGRP | stat.S_IRGRP | stat.S_IXOTH | stat.S_IROTH)
1089
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
 
1090
1146
def query_user(default, prompt):
1091
1147
    """Prompts the user for a string, which is read from a line of stdin.
1092
1148
    Exits silently if EOF is encountered. Returns the string, with spaces