简体   繁体   English

Python distutils排除setup.py

[英]Python distutils exclude setup.py

My setup.py script is simple: 我的setup.py脚本很简单:

from distutils.core import setup
setup(name='my-awesome-app', 
    version='1.0', 
    scripts=['my-awesome-app.py'],
    )

And the file structure is: 文件结构为:

my-awesome-app/
    my-awesome-app.py
    setup.py

In theory I am only including my-awesome-app.py in the distribution. 从理论上讲,我只在发行版中包含my-awesome-app.py In practice setup.py ends up in the RPM too. 实际上, setup.py以RPM结尾。
I don't see a point of including setup.py there, is there a way to force distutils to leave this file out? 我看不到在其中包含setup.py ,有没有办法强迫distutils将这个文件留在外面?
I am using python 2.7, I build my RPM by running python setup.py bdist_rpm . 我正在使用python 2.7,我通过运行python setup.py bdist_rpm构建RPM。
Thanks for help :) 感谢帮助 :)

setup.py is required because when the package is installed in your environment, the following command is run: setup.py是必需的,因为在您的环境中安装该软件包时,将运行以下命令:

$ python setup.py install

Running python setup.py bdist_rpm only creates a distribution package that you can give to others. 运行python setup.py bdist_rpm只会创建一个分发包,您可以将其分发给其他人。 setup.py is still required to do the installation. 仍然需要setup.py来进行安装。

You can always create the spec file manually and leave out the setup.py. 您始终可以手动创建规格文件,而不必使用setup.py。 For example and more details see: https://fedoraproject.org/wiki/Packaging:Python#Example_common_spec_file 有关示例和更多详细信息,请参见: https : //fedoraproject.org/wiki/Packaging : Python#Example_common_spec_file

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM