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

查看:36
本文介绍了清理 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.

对于后删除,我假设您只想在选定命令后进行后删除.子类化各自的命令,覆盖其run方法(在调用base run后调用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天全站免登陆