~launchpad-pqm/launchpad/devel

8 by Canonical.com Patch Queue Manager
Added Soyuz app server start-up and config files
1
#! /usr/bin/env python2.3
2
##############################################################################
3
#
4
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
5
# All Rights Reserved.
6
#
7
# This software is subject to the provisions of the Zope Public License,
8
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
9
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
10
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
11
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
12
# FOR A PARTICULAR PURPOSE.
13
#
14
##############################################################################
15
# arch-tag: 65bbad4c-38de-4a86-9aa5-d4d2fd38c97d
16
"""Start script for Soyuz: loads configuration and starts the server.
17
18
$Id: z3.py 25266 2004-06-04 21:25:45Z jim $
19
"""
20
import os
21
import sys
22
23
basepath = filter(None, sys.path)
24
25
def run(argv=list(sys.argv)):
26
27
    if sys.version_info < ( 2,3,4 ):
28
        print """\
29
        ERROR: Your python version is not supported by Zope3.
30
        Zope3 needs Python 2.3.4 or greater. You are running:""" + sys.version
31
        sys.exit(1)
32
33
    # Refuse to run without principals.zcml
34
    if not os.path.exists('principals.zcml'):
35
        print """\
36
        ERROR: You need to create principals.zcml
37
38
        The file principals.zcml contains your "bootstrap" user
39
        database. You aren't going to get very far without it.  Start
40
        by copying sample_principals.zcml and then modify the
41
        example principal and role settings.
42
        """
43
        sys.exit(1)
44
45
    # setting python paths
46
    program = argv[0]
47
48
    src = 'lib'
49
    here = os.path.dirname(os.path.abspath(program))
50
    srcdir = os.path.abspath(src)
51
    sys.path = [srcdir, here] + basepath
52
53
    from zope.app.server.main import main
54
    main(argv[1:])
55
56
57
if __name__ == '__main__':
58
    run()