【问题标题】:how can setup.py sdist dereference symbolic links?setup.py sdist 如何取消引用符号链接?
【发布时间】:2019-05-03 20:40:43
【问题描述】:

setup.cfg 部分 data_files 包含一个带有符号链接的目录。运行python setup.py sdist 时,生成的分布不包含符号链接,它们被忽略。这里是setup.py的内容,基于pbr

#!/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 取消引用符号链接?

【问题讨论】:

  • 只有在直接使用distutils时才会这样吗?或者在使用setuptools的时候?
  • 上面的留言是from distutils

标签: setuptools distutils python-packaging


【解决方案1】:

很遗憾,graft command 中的 MANIFEST.in 不在python 3 documentation 中,但可以在in the sources 中找到。它调用include_patternfindall 其中follows symbolic links。因此,在MANIFEST.in 中添加以下行就足够了:

graft molecule/

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

符号链接抑制的根本原因是(与sdist 不同)pbr 遍历data_files without following symbolic links 中提到的目录。因此,它将在 SOURCES.txt 文件中创建一个包含符号链接的路径列表。他们将是 ignored by sdist 并且永远不会发布。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-11-14
    • 2020-08-02
    • 2010-12-09
    • 2012-01-13
    • 1970-01-01
    • 1970-01-01
    • 2021-01-20
    • 2021-01-23
    相关资源
    最近更新 更多