使用setuptools将扩展模块分发为源

时间:2012-03-26 08:41:42

标签: python setuptools

我正在测试将Python扩展模块分发为使用setuptools创建的egg。 这是我的setup.py脚本:

from setuptools import setup, Extension

setup(
    name = "Hello",
    version = "0.1.0",                      
    ext_modules = [Extension('Hello', ['Source/Hello.cpp'])]
)

然后我使用“setup.py bdist_egg”构建鸡蛋并使用easy_install进行安装。 一切正常。但是有一个问题。

当我运行“setup.py bdist_egg”并且egg包含pyd时,编译源代码。 但是,我想创建一个包含源的egg,以及用户安装egg时要编译的源。 我该如何更改设置脚本?

2 个答案:

答案 0 :(得分:1)

您创建了一个源分发:python setup.py sdist,它创建了树的压缩快照。然后可以使用easy_install安装它。

但更好的是,如果您想公开发布来源,请使用python package index,并按照文档here进行操作。

答案 1 :(得分:0)

Janne Karila的评论清除了我的困惑:

bdist = binary distribution
sdist = source distribution
bdist_egg = binary distribution as egg

没有sdist_egg。

相关问题