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

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: mattgiuca
  • Date: 2008-01-09 02:20:08 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:131
setup.py:
    - No longer allowed to run as root unless installing (this has caused
      problems for me).
    - Build phase now sets up a relative-path symlink to python inside the
      jail, and install phase no longer has to do this.
    - action_symlink erases existing files first.

Show diffs side-by-side

added added

removed removed

Lines of Context:
126
126
        help([])
127
127
        return 1
128
128
 
 
129
    # Disallow run as root unless installing
 
130
    if operation != 'install' and os.geteuid() == 0:
 
131
        print >>sys.stderr, "I do not want to run this stage as root."
 
132
        print >>sys.stderr, "Please run as a normal user."
 
133
        return 1
129
134
    # Call the requested operation's function
130
135
    try:
131
136
        oper_func = {
149
154
        print """Usage: python setup.py operation [args]
150
155
Operation (and args) can be:
151
156
    help [operation]
 
157
    listmake (developer use only)
152
158
    conf [args]
153
159
    build
154
160
    install [--nojail] [-n|--dry]
476
482
    copy_file_to_jail('/lib/tls/i686/cmov/libpthread.so.0', dry)
477
483
    copy_file_to_jail('/lib/tls/i686/cmov/libutil.so.1', dry)
478
484
    copy_file_to_jail('/usr/bin/python2.5', dry)
479
 
    # TODO: ln -s jail/usr/bin/python2.5 jail/usr/bin/python
 
485
    action_symlink('python2.5', 'jail/usr/bin/python', dry)
480
486
    action_copytree('/usr/lib/python2.5', 'jail/usr/lib/python2.5', dry)
481
487
 
482
488
def copy_file_to_jail(src, dry):
518
524
        # to the jails template directory (it will be used as a template
519
525
        # for all the students' jails).
520
526
        action_copytree('jail', os.path.join(jail_base, 'template'), dry)
521
 
        # Set up symlinks inside the jail
522
 
        action_symlink(os.path.join(jail_base, 'template/usr/bin/python2.5'),
523
 
            os.path.join(jail_base, 'template/usr/bin/python'), dry)
524
527
 
525
528
    return 0
526
529
 
610
613
    dstdir = os.path.split(dst)[0]
611
614
    if not os.path.isdir(dstdir):
612
615
        action_mkdir(dstdir, dry)
613
 
    print "ln -s", src, dst
 
616
    # Delete existing file
 
617
    if os.path.exists(dst):
 
618
        os.remove(dst)
 
619
    print "ln -fs", src, dst
614
620
    if not dry:
615
621
        os.symlink(src, dst)
616
622