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

« back to all changes in this revision

Viewing changes to setup/install.py

Remove phpBB3 configuration from ivle-config.

Now the only forum-related thing in the main IVLE configuration is the forum
secret. That also now persists across configurations, rather than being
clobbered.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
import os
24
24
import sys
25
25
import functools
26
 
import distutils.sysconfig
27
26
 
28
27
from setup import util
29
28
 
 
29
PYTHON_VERSION = sys.version[:3]
 
30
 
30
31
def install(args):
31
32
    usage = """usage: %prog install [options]
32
33
(Requires root)
34
35
Create $target/bin.
35
36
Copy bin/trampoline/trampoline to $target/bin.
36
37
Copy bin/timount/timount to $target/bin.
 
38
Copy etc/ivle.conf to /etc/ivle/ivle.conf.
37
39
chown and chmod the installed trampoline.
 
40
Copy www/ to $target.
38
41
"""
39
42
 
40
43
    # Parse arguments
56
59
    parser.add_option("--python-site-packages",
57
60
        action="store", dest="python_site_packages",
58
61
        help="Path to Python site packages directory.",
59
 
        default=None)
 
62
        default='/usr/local/lib/python%s/site-packages' % PYTHON_VERSION)
60
63
    (options, args) = parser.parse_args(args)
61
64
 
62
 
    # Prefix must be absolute (not really necessary, but since a relative
63
 
    # prefix will be taken relative to *root* not working directory, it is
64
 
    # confusing if we allow it).
65
 
    if options.prefix[:1] not in (os.path.sep, os.path.altsep):
66
 
        print >>sys.stderr, """prefix must be an absolute path.
67
 
    (This will be interpreted relative to root, so provide --root=. if you
68
 
    want a path relative to the working directory)."""
69
 
        return 1
70
 
 
71
 
    # Calculate python_site_packages using the supplied prefix
72
 
    if options.python_site_packages is None:
73
 
        options.python_site_packages = distutils.sysconfig.get_python_lib(
74
 
            prefix=options.prefix)
75
 
 
76
65
    # Call the real function
77
66
    return __install(prefix=options.prefix,
78
67
                     python_site_packages=options.python_site_packages,
102
91
        print >>sys.stderr, "Must be root to run install"
103
92
        return 1
104
93
 
105
 
    # Create the config directory.
106
 
    util.action_mkdir(mip('/etc/ivle/plugins.d'), dry)
107
 
 
108
94
    # Create lib and copy the compiled files there
109
95
    util.action_mkdir(lib_path, dry)
110
96
 
126
112
    util.action_copylist(install_list.list_user_binaries, bin_path, dry,
127
113
                         onlybasename=True)
128
114
 
 
115
    # Copy the www directory (using the list)
 
116
    util.action_copylist(install_list.list_www, share_path, dry)
 
117
 
 
118
    # Set appropriate permissions on the php directory
 
119
    forum_dir = "www/php/phpBB3"
 
120
    forum_path = os.path.join(share_path, forum_dir)
 
121
    print "chown -R www-data:www-data %s" % forum_path
 
122
    if not dry:
 
123
        os.system("chown -R www-data:www-data %s" % forum_path)
 
124
 
129
125
    # Copy the lib directory (using the list)
130
126
    util.action_copylist(install_list.list_ivle_lib, python_site_packages, dry)
131
127
 
 
128
    # XXX We shouldn't have ivle.pth at all any more.
 
129
    # We may still need the www packages to be importable.
 
130
    # Anything from www that is needed from the outside should go to lib.
 
131
    ivle_pth = os.path.join(python_site_packages, "ivle.pth")
 
132
    try:
 
133
        file = open(ivle_pth, 'w')
 
134
        file.write(os.path.join(share_path, "www"))
 
135
        file.close()
 
136
    except (IOError, OSError):
 
137
        pass
 
138
 
132
139
    if not nosvnrevno:
133
140
        # Create the ivle working revision record file
134
141
        ivle_revision_file = os.path.join(share_path, 'revision.txt')