如何在python包中指定entry_points脚本的安装位置?

时间:2014-05-06 15:20:28

标签: python package debian setup.py

我有一个带有setup.py文件的python包,如下所示:

 setup(name=project_name,
    packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
    include_package_data=True,
    zip_safe=False,
    entry_points="""
    [console_scripts]
    sound-run = sound.run:start
    sound-resume = sound.run:resume
    """
    # Other setuptools stuff
    )

我试图这样做,当作为debian软件包安装时,脚本(声音运行,声音恢复)二进制文件最终会出现在我指定的目标中。目前,当我制作debian软件包时,脚本最终会出现在/ usr / local / bin /中,但我希望将它们安装到/ usr / local / myfolder / myfolder1中。

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

python setup.py --install-scripts destination。请参阅--help选项和https://docs.python.org/2.7/install/index.html#custom-installation

请注意,这是由distutils提供的,setuptools扩展了;我假设setuptools入口点生成的脚本也尊重该选项。

关于您的用例,Debian有特定的帮助程序,可以将东西安装到正确的位置,以便Debian工具可以完成这项工作。我建议使用dh和pybuild以及dh_python2。