如何在setup.py中添加头文件,以便在构建扩展时观察到依存关系? [英] How to add header files in setup.py so dependencies are observed when building the extensions?

查看:81
本文介绍了如何在setup.py中添加头文件,以便在构建扩展时观察到依存关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题似乎很长,但这全都取决于我如何将头文件添加到特定的扩展规范中。

The question seems long, but it all comes down to how I can add header files to specific extension specification.

动机是,如果我更改其中一个头文件,发出

The motivation is that if I change one of the header files, issuing

python setup.py build

python setup.py build

即使没有.c,也应重建扩展名文件已更改。

should rebuild the extension even when none of the .c files are changed.

我尝试在Extension构造函数的 sources关键字arg中添加依赖的头文件,但运行生成的setup.py产生错误抱怨关于未知文件扩展名 .h。

I've tried to add the depending header files in "sources" keyword arg in the Extension constructor, but running the resulting setup.py generated errors complaining about unknown file extension ".h".

谢谢!

推荐答案

查看 depends 选项扩展类中。我没有亲自使用过,但您的确切示例已列为用例。

Take a look at the depends option on the Extension class. I've not used it myself, but your exact example is listed as a use-case.

这篇关于如何在setup.py中添加头文件,以便在构建扩展时观察到依存关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆