How to add a script to a buildout project?
I have setup.py in a buildout project:
from distutils.core import setup
setup(name='',
version='1.0',
author='Denis Kolodin'开发者_运维知识库,
author_email='...',
url='...',
scripts = ['scripts/myscript.py'], # The script I want to add to 'bin/' dir
)
Why buildout don't add that script to 'bin/'? Can I develop scripts (not eggs) with buildout?
My buildout.cfg:
[buildout]
develop = .
parts = python scripts
[python]
recipe = zc.recipe.egg
interpreter = python
eggs = marketwizard > 0.2.0
jinja2
[scripts]
recipe = z3c.recipe.scripts
At the moment, this is a buildout limitation: it does not understand the "script=" from your setup.py. It does understand the "console_scripts=" so-called "entry point" from setuptools. Google for it or look at an existing project that has it.
I've got a fix for buildout to make it support "scripts=", but that hasn't been accepted for inclusion yet.
I just make a real example.
Example setup.py
setup(name='',
version='1.0',
author='Denis Kolodin',
author_email='...',
url='...',
entry_points={
"console_scripts": [
'myscript = scripts.myscript:main_function',
]
}
)
Example buildout.cfg
[buildout]
develop = .
parts = python scripts
[python]
recipe = zc.recipe.egg
interpreter = python
eggs = marketwizard > 0.2.0
jinja2
[scripts]
recipe = zc.recipe.egg:scripts
# to be available in your script
eggs = ${python:eggs}
scripts = myscript
Note: main_function
this is function name (could any name) from your script module.
精彩评论