setuptools - setup.py sdist 如何解引用符号链接(symbolic link)?

标签 setuptools distutils python-packaging

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

#!/usr/bin/env python

from setuptools import setup

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

取消引用符号链接(symbolic link)并包含实际文件会很好。分布会更大,因为文件是重复的,但它会是完整的。

查看 sdist sources看起来符号链接(symbolic link)总是被忽略:

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

是否有解决方法说服 sdist 取消引用符号链接(symbolic link)?

最佳答案

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

graft molecule/

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

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

关于setuptools - setup.py sdist 如何解引用符号链接(symbolic link)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55976838/

相关文章:

可自行下载的 Python Web 应用程序

python - 错误: package directory XYZ does not exist

python - PyCrypto 在 Windows 上安装错误

Python包导入: What's the rule for addressing submodules?

python - 包 'see' 本身是否在 __init__.py 中?

python - 如何将 extras_require 放入 setup.cfg

在 github 操作中运行时不会发生 Python 自动版本控制

python - 导入 Cython 模块时出现 undefined symbol 错误

python - 在 setup.py 要求中提供 pytz 版本

python - Pip 安装错误缺少 'libxml/xmlversion.h'