Skip to content

Instantly share code, notes, and snippets.

@danmueller
Created May 28, 2009 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danmueller/119302 to your computer and use it in GitHub Desktop.
Save danmueller/119302 to your computer and use it in GitHub Desktop.
short zc.buildout demo
bin
*eggs/
*.egg-info/
.installed.cfg
**/*.pyc
jython_installer-2.5*.jar
jyt/
import logging
logging.basicConfig(level=logging.INFO,
format='[%(name)s %(levelname)s] %(message)s')
# format='[%(levelname)s] %(message)s')
logging.getLogger('boto').setLevel(logging.DEBUG)
##############################################################################
#
# Copyright (c) 2006 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-based project
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.
$Id$
"""
import os, shutil, sys, tempfile, urllib2
tmpeggs = tempfile.mkdtemp()
is_jython = sys.platform.startswith('java')
try:
import pkg_resources
except ImportError:
ez = {}
exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
).read() in ez
ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
import pkg_resources
if sys.platform == 'win32':
def quote(c):
if ' ' in c:
return '"%s"' % c # work around spawn lamosity on windows
else:
return c
else:
def quote (c):
return c
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']
if is_jython:
import subprocess
assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mZNxd',
quote(tmpeggs), 'zc.buildout' + VERSION],
env=dict(os.environ,
JYTHONPATH=
ws.find(pkg_resources.Requirement.parse('setuptools')).location
),
).wait() == 0
else:
assert os.spawnle(
os.P_WAIT, sys.executable, quote (sys.executable),
'-c', quote (cmd), '-mqNxd', quote (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)
[config]
mypkgs = activemq_stress
[buildout]
develop = .
parts = python scripts test
[python]
recipe = zc.recipe.egg
interpreter = python
eggs = ${config:mypkgs}
[scripts]
recipe = zc.recipe.egg:scripts
eggs = ${config:mypkgs}
[test]
recipe = zc.recipe.testrunner
eggs = ${config:mypkgs}
#!/bin/bash
echo "please copy the the installer into this dir"
echo "you can download it from: http://downloads.sourceforge.net/jython/jython_installer-2.5rc3.jar"
echo "If you need to get a new version of the bootstrap"
echo "get it from: http://svn.zope.org/*checkout*/zc.buildout/trunk/bootstrap/bootstrap.py"
class DotLookup(object):
def __init__(self, obj):
self.obj = obj
def __getitem__(self, key):
return DotLookup(self.obj[key])
def __getattr__(self, key):
return self[key]
def get(self, key, default=None):
try:
return self[key]
except (KeyError, IndexError):
return default
def __call__(self):
return self.obj
#!/bin/bash
rm -rf jyt/
java -jar jython_installer-2.5rc3.jar -s -d jyt
#!/usr/bin/env python
from setuptools import setup
setup(name='activemq_stress',
version='0.0.1',
description='Stress testing tools for ActiveMQ >5.2.0',
long_description="""
""",
author='Daniel',
author_email='',
url='http://todo/',
packages=['activemq_stress'],
package_dir={'': 'src'},
install_requires=[
'boto==1.7a',
'PyYAML==3.05',
# 'Gnosis_Utils==1.2.1-a',
],
entry_points=("""
[console_scripts]
instances=activemq_stress.instances:main
activemq=activemq_stress.activemq:main
tryout=activemq_stress.tryout:main
"""),
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: Python Software Foundation License',
'Environment :: Console',
'Environment :: Web Environment',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Programming Language :: Python',
'Topic :: Software Development :: Commandline',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators'
],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment