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

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: mattgiuca
  • Date: 2007-12-21 01:43:49 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:116
setup.py: mkdir now properly obeys "dry".
    "build" now compiles all python files in the directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
import getopt
65
65
import string
66
66
import errno
 
67
import compileall
67
68
 
68
69
# Try importing existing conf, but if we can't just set up defaults
69
70
# The reason for this is that these settings are used by other phases
167
168
Args are:
168
169
"""
169
170
    elif operation == 'build':
170
 
        print """python setup.py build
 
171
        print """python -O setup.py build
171
172
Compiles all files and sets up a jail template in the source directory.
 
173
-O is recommended to cause compilation to be optimised.
172
174
Details:
173
175
Compiles (GCC) trampoline/trampoline.c to trampoline/trampoline.
174
176
Creates jail/.
176
178
Copies console/ to a location within the jail.
177
179
Copies OS programs and files to corresponding locations within the jail
178
180
  (eg. python and Python libs, ld.so, etc).
179
 
Generates .pyc files for all the IVLE .py files."""
 
181
Generates .pyc or .pyo files for all the IVLE .py files."""
180
182
    elif operation == 'listmake':
181
183
        print """python setup.py listmake
182
184
(For developer use only)
221
223
        file.write("""# IVLE Configuration File
222
224
# install_list.py
223
225
# Provides lists of all Python files to be installed by `setup.py install'.
 
226
# Note that any files with the given filename plus 'c' or 'o' (that is,
 
227
# compiled .pyc or .pyo files) will be copied as well.
224
228
 
225
229
# List of all installable Python files in www directory.
226
230
list_www = """)
402
406
        'trampoline/trampoline.c'], dry)
403
407
 
404
408
    # Create the jail and its subdirectories
405
 
    action_mkdir('jail')
406
 
    action_mkdir('jail/bin')
407
 
    action_mkdir('jail/lib')
408
 
    action_mkdir('jail/usr/bin')
409
 
    action_mkdir('jail/usr/lib')
410
 
    action_mkdir('jail/opt/ivle')
411
 
    action_mkdir('jail/home')
412
 
    action_mkdir('jail/tmp')
 
409
    action_mkdir('jail', dry)
 
410
    action_mkdir('jail/bin', dry)
 
411
    action_mkdir('jail/lib', dry)
 
412
    action_mkdir('jail/usr/bin', dry)
 
413
    action_mkdir('jail/usr/lib', dry)
 
414
    action_mkdir('jail/opt/ivle', dry)
 
415
    action_mkdir('jail/home', dry)
 
416
    action_mkdir('jail/tmp', dry)
413
417
 
414
418
    # TODO: Copy console into the jail
415
419
    # TODO: Copy operating system files into the jail
416
 
    # TODO: Compile .py files into .pyc files
 
420
    # Compile .py files into .pyc or .pyo files
 
421
    compileall.compile_dir('www', quiet=True)
 
422
    compileall.compile_dir('console', quiet=True)
417
423
 
418
424
    return 0
419
425
 
450
456
    if ret != 0:
451
457
        raise RunError(prog, ret)
452
458
 
453
 
def action_mkdir(path):
 
459
def action_mkdir(path, dry):
454
460
    """Calls mkdir. Silently ignored if the directory already exists.
455
461
    Creates all parent directories as necessary."""
456
462
    print "mkdir -p", path