#!/usr/bin/env python2.4
##############################################################################
#
# Copyright (c) 2005 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Script to create a new ZEO instance home.

$Id$
"""

import os
import sys

here = os.path.dirname(os.path.realpath(__file__))
swhome = os.path.dirname(here)

for parts in [
    ("src",), 
    ("lib", "python"), 
    ("lib64", "python"), 
    ("Lib", "site-packages"),
    ]:
    d = os.path.join(swhome, *(parts + ("ZEO",)))
    if os.path.isdir(d):
        d = os.path.join(swhome, *parts)
        sys.path.insert(0, d)
        break
else:
    try:
        import ZEO
    except ImportError:
        print >>sys.stderr, "Could not locate ZODB software installation!"
        sys.exit(1)


from ZEO.mkzeoinst import ZEOInstanceBuilder
ZEOInstanceBuilder().run()
