Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 79 lines (65 sloc) 2.402 kB
98d5c6e @jacobian Now using buildout for development, packaging.
jacobian authored
1 #!/usr/bin/env python
2 ##############################################################################
3 #
4 # Copyright (c) 2006 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 """Bootstrap a buildout-based project
16
17 Simply run this script in a directory containing a buildout.cfg.
18 The script accepts buildout command-line options, so you can
19 use the -c option to specify an alternate configuration file.
20
21 $Id$
22 """
23
24 import os, shutil, sys, tempfile, urllib2
25
26 tmpeggs = tempfile.mkdtemp()
27
28 is_jython = sys.platform.startswith('java')
29
30 try:
31 import pkg_resources
32 except ImportError:
33 ez = {}
34 exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
35 ).read() in ez
36 ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
37
38 import pkg_resources
39
40 if sys.platform == 'win32':
41 def quote(c):
42 if ' ' in c:
43 return '"%s"' % c # work around spawn lamosity on windows
44 else:
45 return c
46 else:
47 def quote (c):
48 return c
49
50 cmd = 'from setuptools.command.easy_install import main; main()'
51 ws = pkg_resources.working_set
52
53 if is_jython:
54 import subprocess
55
56 assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd',
57 quote(tmpeggs), 'zc.buildout'],
58 env=dict(os.environ,
59 PYTHONPATH=
60 ws.find(pkg_resources.Requirement.parse('setuptools')).location
61 ),
62 ).wait() == 0
63
64 else:
65 assert os.spawnle(
66 os.P_WAIT, sys.executable, quote (sys.executable),
67 '-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout',
68 dict(os.environ,
69 PYTHONPATH=
70 ws.find(pkg_resources.Requirement.parse('setuptools')).location
71 ),
72 ) == 0
73
74 ws.add_entry(tmpeggs)
75 ws.require('zc.buildout')
76 import zc.buildout.buildout
77 zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
78 shutil.rmtree(tmpeggs)
Something went wrong with that request. Please try again.