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

« back to all changes in this revision

Viewing changes to setup/install.py

setup.install: Now takes --prefix and --python-site-packages as arguments. NO
    LONGER reads them from config.
    The setup process (build and install) now knows nothing about the config
    file. This enables configuration POST-installation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
from setup import util
28
28
 
 
29
PYTHON_VERSION = sys.version[:3]
 
30
 
29
31
def install(args):
30
32
    usage = """usage: %prog install [options]
31
33
(Requires root)
50
52
        action="store", dest="rootdir",
51
53
        help="Install into a different root directory.",
52
54
        default='/')
 
55
    parser.add_option("--prefix",
 
56
        action="store", dest="prefix",
 
57
        help="Base prefix to install IVLE into (default: /usr/local).",
 
58
        default='/usr/local')
 
59
    parser.add_option("--python-site-packages",
 
60
        action="store", dest="python_site_packages",
 
61
        help="Path to Python site packages directory.",
 
62
        default='/usr/lib/python%s/site-packages' % PYTHON_VERSION)
53
63
    (options, args) = parser.parse_args(args)
54
64
 
55
65
    # Call the real function
56
 
    return __install(dry=options.dry, rootdir=options.rootdir,
 
66
    return __install(prefix=options.prefix,
 
67
                     python_site_packages=options.python_site_packages,
 
68
                     dry=options.dry, rootdir=options.rootdir,
57
69
                     nosvnrevno=options.nosvnrevno)
58
70
 
59
 
def __install(dry=False, rootdir=None, nosvnrevno=False):
60
 
    # We need to import the one in the working copy, not in the system path.
61
 
    confmodule = __import__("ivle/conf/conf")
 
71
def __install(prefix, python_site_packages, dry=False, rootdir=None,
 
72
              nosvnrevno=False):
62
73
    install_list = util.InstallList()
63
74
 
64
75
    # We need to apply make_install_path with the rootdir to an awful lot of
65
76
    # config variables, so make it easy:
66
77
    mip = functools.partial(util.make_install_path, rootdir)
67
78
 
68
 
    # Pull the required varibles out of the config
69
 
    lib_path = mip(confmodule.lib_path)
70
 
    share_path = mip(confmodule.share_path)
71
 
    bin_path = mip(confmodule.bin_path)
72
 
    python_site_packages = mip(confmodule.python_site_packages)
 
79
    # Compute the lib_path, share_path and bin_path (copied from
 
80
    # ivle/conf/conf.py).
 
81
    lib_path = mip(os.path.join(prefix, 'lib/ivle'))
 
82
    share_path = mip(os.path.join(prefix, 'share/ivle'))
 
83
    bin_path = mip(os.path.join(prefix, 'bin'))
 
84
    python_site_packages = mip(python_site_packages)
73
85
 
74
86
    # Must be run as root or a dry run  
75
87
    if dry:
90
102
    timountpath = os.path.join(lib_path, 'timount')
91
103
    util.action_copyfile('bin/timount/timount', timountpath, dry)
92
104
 
93
 
    ivleconfpath = mip('/etc/ivle/ivle.conf')
94
 
    util.action_copyfile('etc/ivle.conf', ivleconfpath, dry)
95
 
 
96
105
    # Copy in the services (only usrmgt-server is needed on the host, but
97
106
    # the jail build requires the rest).
98
107
    util.action_copylist(install_list.list_services, share_path, dry)