清理setup.py中的构建目录 [英] Cleaning build directory in setup.py

查看:52
本文介绍了清理setup.py中的构建目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该如何预先删除我的 setup.py 并后删除构建目录?

How could I make my setup.py pre-delete and post-delete the build directory?

推荐答案

对于预删除,只需在调用setup之前用 distutils.dir_util.remove_tree 删除它即可。

For pre-deletion, just delete it with distutils.dir_util.remove_tree before calling setup.

对于后删除,我假设您只想在选定命令后进行后删除。子类化各自的命令,重写其运行方法(在调用基本运行之后调用remove_tree),并将新命令传递到setup的cmdclass字典中。

For post-delete, I assume you only want to post-delete after selected commands. Subclass the respective command, override its run method (to invoke remove_tree after calling the base run), and pass the new command into the cmdclass dictionary of setup.

这篇关于清理setup.py中的构建目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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