bootstrap.py
author Daniel Hans <Daniel.M.Hans@gmail.com>
Fri, 07 Aug 2009 01:27:24 +0200
changeset 2736 8f3935f0f4ba
parent 2587 ec7818110fd2
permissions -rw-r--r--
Argument store added to updateEntityProperties. This argument determines if an entity should be stored in the data model after its properties are updated. It may be useful, for example, along with tasks (Task Queue API). One may want to make some modifications to an entity during execution of a task, but the developer is sure that at least one new task, which also wants to modify the entity, will be queued, so he or she can just update the entity without saving the changes to the data model, set the entity in memcache and the following task (which is to be executed very shortly) is to retrive the current entity from the memcache (without any expensive calls to the actual data model).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2587
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     1
##############################################################################
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     2
#
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     3
# Copyright (c) 2006 Zope Corporation and Contributors.
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     4
# All Rights Reserved.
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     5
#
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     6
# This software is subject to the provisions of the Zope Public License,
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     7
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     8
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     9
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    10
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    11
# FOR A PARTICULAR PURPOSE.
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    12
#
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    13
##############################################################################
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    14
"""Bootstrap a buildout-based project
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    15
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    16
Simply run this script in a directory containing a buildout.cfg.
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    17
The script accepts buildout command-line options, so you can
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    18
use the -c option to specify an alternate configuration file.
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    19
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    20
$Id: bootstrap.py 73144 2007-03-12 05:25:36Z baijum $
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    21
"""
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    22
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    23
import os, shutil, sys, tempfile, urllib2
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    24
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    25
tmpeggs = tempfile.mkdtemp()
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    26
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    27
ez = {}
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    28
exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    29
                     ).read() in ez
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    30
ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    31
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    32
import pkg_resources
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    33
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    34
cmd = 'from setuptools.command.easy_install import main; main()'
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    35
if sys.platform == 'win32':
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    36
    cmd = '"%s"' % cmd # work around spawn lamosity on windows
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    37
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    38
ws = pkg_resources.working_set
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    39
assert os.spawnle(
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    40
    os.P_WAIT, sys.executable, sys.executable,
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    41
    '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    42
    dict(os.environ,
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    43
         PYTHONPATH=
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    44
         ws.find(pkg_resources.Requirement.parse('setuptools')).location
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    45
         ),
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    46
    ) == 0
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    47
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    48
ws.add_entry(tmpeggs)
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    49
ws.require('zc.buildout')
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    50
import zc.buildout.buildout
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    51
zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
ec7818110fd2 Start using buildout to bring in external dependencies.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    52
shutil.rmtree(tmpeggs)