File: bootstrap.py

package info (click to toggle)
jsonbot 0.84.4-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 5,632 kB
  • sloc: python: 56,224; sh: 250; makefile: 25
file content (53 lines) | stat: -rw-r--r-- 1,389 bytes parent folder | download
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""Bootstraps the TyphoonAE environment.

Simply run this script in a directory containing a buildout.cfg.
The script accepts buildout command-line options, so you can
use the -c option to specify an alternate configuration file.
"""

import os
import shutil
import sys
import tempfile
import urllib2

tmpeggs = tempfile.mkdtemp()

#try:
#    import pkg_resources
#except ImportError:
if True:
    ez = {}
    exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
                         ).read() in ez
    ez['use_setuptools'](to_dir=tmpeggs, download_delay=0, version="0.6c9")

    import pkg_resources

cmd = 'from setuptools.command.easy_install import main; main()'
ws  = pkg_resources.working_set

if len(sys.argv) > 2 and sys.argv[1] == '--version':
    VERSION = '==%s' % sys.argv[2]
    args = sys.argv[3:] + ['bootstrap']
else:
    VERSION = ''
    args = sys.argv[1:] + ['bootstrap']

assert os.spawnle(
    os.P_WAIT, sys.executable, sys.executable,
    '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout' + VERSION,
    dict(os.environ,
        PYTHONPATH=
        ws.find(pkg_resources.Requirement.parse('setuptools')).location
        ),
    ) == 0

ws.add_entry(tmpeggs)
ws.require('zc.buildout' + VERSION)
import zc.buildout.buildout
zc.buildout.buildout.main(args)
shutil.rmtree(tmpeggs)

if not os.path.isdir('var'):
    os.makedirs(os.path.join('var', 'log'))