bootstrap.py 1.94 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
##############################################################################
#
# 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.
#
##############################################################################
"""Bootstrap a buildout

$Id$
"""

import os, sys, urllib2

for d in 'eggs', 'bin':
    if not os.path.exists(d):
        os.mkdir(d)

ez = {}
exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
                     ).read() in ez

ez['use_setuptools'](to_dir='eggs', download_delay=0)

import setuptools.command.easy_install
import pkg_resources
import setuptools.package_index
import distutils.dist

os.spawnle(os.P_WAIT, sys.executable, sys.executable, 'setup.py',
37
           '-q', 'develop', '-m', '-x', '-d', 'develop-eggs',
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
           {'PYTHONPATH': os.path.dirname(pkg_resources.__file__)},
           )

## easy = setuptools.command.easy_install.easy_install(
##     distutils.dist.Distribution(),
##     multi_version=True,
##     exclude_scripts=True,
##     sitepy_installed=True,
##     install_dir='eggs',
##     outputs=[],
##     quiet=True,
##     zip_ok=True,
##     args=['zc.buildout'],
##     )
## easy.finalize_options()
## easy.easy_install('zc.buildout')

env = pkg_resources.Environment(['eggs'])

ws = pkg_resources.WorkingSet()
sys.path[0:0] = [
    d.location
    for d in ws.resolve([pkg_resources.Requirement.parse('zc.buildout')], env)
    ]

import zc.buildout.egglinker
zc.buildout.egglinker.scripts(['zc.buildout'], 'bin', ['eggs'])

sys.exit(os.spawnl(os.P_WAIT, 'bin/buildout', 'bin/buildout'))