使用“entry”points添加setuptools命令`

2024-10-03 17:28:39 发布

您现在位置:Python中文网/ 问答频道 /正文

是否可以通过使用setup()调用的entry_points参数将自定义setuptools命令添加到项目中?在

例如,我在项目的setup()调用中添加了以下内容:

entry_points = {
    'distutils.commands': [
        'abc = sphinx.setup_command:BuildDoc',
    ],
},

但是当我做python setup.py --help-commands时,仍然没有abc命令。有什么想法吗?在

https://pythonhosted.org/setuptools/setuptools.html#adding-commands


Tags: 项目py命令参数sphinxsetuphelpsetuptools
1条回答
网友
1楼 · 发布于 2024-10-03 17:28:39

如果您的目标是添加一个要通过^{运行的setuptools命令,我已经成功地完成了以下工作。在


import sphinx.setup_command

setup(
  ...

  cmdclass={
      'abc': sphinx.setup_command.BuildDoc
  }, ...
)

extending distutils here.

相关问题 更多 >