如何使setuptools忽略Subversion库存? [英] How can I make setuptools ignore subversion inventory?

查看:66
本文介绍了如何使setuptools忽略Subversion库存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将Python软件包与使用setuptools的setup.py打包时:

When packaging a Python package with a setup.py that uses the setuptools:

from setuptools import setup
...

由以下人员创建的源分发:

the source distribution created by:

python setup.py sdist

不仅像往常一样包括MANIFEST.in中指定的文件,而且还无故包括在包目录下包含Subversion列出的受版本控制的所有文件.这非常烦人.这不仅使您很难对通过程序包分发哪些文件进行任何形式的明确控制,而且这意味着当我按照"svn导出"而不是"svn检出"来构建程序包时,我的内容软件包可能会大不相同,因为如果没有.svn元数据设置工具,它将对要包含的内容做出不同的选择.

not only includes, as usual, the files specified in MANIFEST.in, but it also, gratuitously, includes all of the files that Subversion lists as being version controlled beneath the package directory. This is vastly annoying. Not only does it make it difficult to exercise any sort of explicit control over what files get distributed with my package, but it means that when I build my package following an "svn export" instead of an "svn checkout", the contents of my package might be quite different, since without the .svn metadata setuptools will make different choices about what to include.

我的问题:如何关闭这种可怕的行为,以便"setuptools"以相同的方式对待我的项目,无论我使用的是Subversion,还是从未听说过的版本控制,还是使用"svn export"创建的裸树是我在项目结束时创建的,以确保它可以在我的工作目录之外的其他地方清晰地构建?

My question: how can I turn off this terrible behavior, so that "setuptools" treats my project the same way whether I'm using Subversion, or version control it's never heard of, or a bare tree created with "svn export" that I've created at the end of my project to make sure it builds cleanly somewhere besides my working directory?

到目前为止,我管理的最好的是一个丑陋的猴子补丁:

The best I have managed so far is an ugly monkey-patch:

from setuptools.command import sdist
del sdist.finders[:]

但这是Python,而不是丛林,因此,我当然希望有一个更好的解决方案,根本不涉及任何猴子.我该如何驯服setuptools,关闭它的魔力,并通过查看MANIFEST.py中可见的,可预测的规则来使其表现得明智呢?

But this is Python, not the jungle, so of course I want a better solution that involves no monkeys at all. How can I tame setuptools, turn off its magic, and have it behave sensibly by looking at the visible, predictable rules in my MANIFEST.py instead?

推荐答案

简单的解决方案,请勿使用setuptools创建源代码发行版,而应将该命令降级为distutils:

Simple solution, do not use setuptools for creating the source distribution, downgrade to distutils for that command:

from distutils.command.sdist import sdist
from setuptools import setup

setup(
    # ... all the usual setup arguments ...
    cmdclass = {'sdist': sdist},
)

这篇关于如何使setuptools忽略Subversion库存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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