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

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: mattgiuca
  • Date: 2008-01-21 06:02:46 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:256
Changed the way IVLE's path is loaded into Python's sys.path. Now a file
"ivle.pth" is installed in Python's site packages which has the location of
the path. This replaces the method of using dispatch_handler.py.

* Removed dispatch_handler.py. No longer required.
* setup.py now automatically writes ivle.pth to Python's site packages.
* Updated README to indicate the new way to set up Apache. It's a lot simpler
  now, and you can run multiple IVLEs in the same server.

Hooray!

Show diffs side-by-side

added added

removed removed

Lines of Context:
598
598
        # for all the students' jails).
599
599
        action_copytree('jail', os.path.join(jail_base, 'template'), dry)
600
600
 
 
601
    # Append IVLE path to ivle.pth in python site packages
 
602
    # (Unless it's already there)
 
603
    ivle_pth = os.path.join(sys.prefix,
 
604
        "lib/python2.5/site-packages/ivle.pth")
 
605
    ivle_www = os.path.join(ivle_install_dir, "www")
 
606
    write_ivle_pth = True
 
607
    try:
 
608
        file = open(ivle_pth, 'r')
 
609
        for line in file:
 
610
            if line.strip() == ivle_www:
 
611
                write_ivle_pth = False
 
612
                break
 
613
    except (IOError, OSError):
 
614
        pass
 
615
    if write_ivle_pth:
 
616
        action_append(ivle_pth, ivle_www)
 
617
 
601
618
    return 0
602
619
 
603
620
def updatejails(args):
762
779
    if not dry:
763
780
        os.symlink(src, dst)
764
781
 
 
782
def action_append(ivle_pth, ivle_www):
 
783
    file = open(ivle_pth, 'a+')
 
784
    file.write(ivle_www + '\n')
 
785
    file.close()
 
786
 
765
787
def action_chown_setuid(file, dry):
766
788
    """Chowns a file to root, and sets the setuid bit on the file.
767
789
    Calling this function requires the euid to be root.