簡體   English   中英

如何將腳本添加到擴展項目?

[英]How to add a script to a buildout project?

我在一個擴展項目中有setup.py

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
)

為什么buildout不將腳本添加到'bin /'? 我可以使用擴展來開發腳本(不是雞蛋)嗎?

我的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

目前,這是一個擴展限制:它無法理解setup.py中的“ script =”。 確實了解setuptools中的“ console_scripts =”所謂的“入口點”。 使用Google或查看現有的項目。

我已經解決了構建問題,使其支持“ scripts =“,但尚未被接受。

我只是舉一個真實的例子。

示例setup.py

setup(name='',
  version='1.0',
  author='Denis Kolodin',
  author_email='...',
  url='...',
  entry_points={
    "console_scripts": [
        'myscript = scripts.myscript:main_function',
    ]
  }
)

示例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

注意: main_function這是腳本模塊中的函數名稱(可以是任何名稱)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM