setup.py sdist如何取消引用符号链接?

时间:2019-05-03 20:40:44

标签: python sdist

setup.cfg部分data_files包含带有符号链接的目录。运行python setup.py sdist时,结果分发不包含符号链接,它们将被忽略。以下是基于pbrsetup.py的内容:

#!/usr/bin/env python

from setuptools import setup

setup(
    setup_requires=['pbr'],
    pbr=True,
)

取消引用符号链接并包含实际文件会很好。由于文件是重复的,因此分发会更大,但是它将是完整的。

看着sdist sources,似乎总是忽略符号链接:

$ python setup.py sdist
...
'molecule/debops' not a regular file -- skipping
...

是否有一种解决方法可以说服sdist取消引用符号链接?

1 个答案:

答案 0 :(得分:1)

不幸的是,graft command中的MANIFEST ..不在python 3 documentation中,但可以在in the sources中找到。它调用include_patternfindallfollows symbolic links。因此,将以下行添加到MANIFEST.in就足够了:

graft molecule/

确保分发中包含molecule/树,并且将遵循所有符号链接。这确实导致内容重复,但结果是完整的。

符号链接抑制的根本原因是(不同于sdistpbr遍历data_files without following symbolic links中提到的目录。因此,它将在SOURCES.txt文件中创建包含符号链接的路径列表。他们将是ignored by sdist,永远不会进入发行版。

相关问题