【问题标题】:setuptools warning: Failed to find the configured license file 'L'setuptools 警告:找不到配置的许可证文件“L”
【发布时间】:2021-04-13 15:32:33
【问题描述】:

我正在使用 python setup.py bdist_wheel 基本上是setuptools 库。

我的项目在存储库的根目录中包含LICENSE.txt 文件。

目标:

在轮子中正确包含这个特定的许可证文件

相关代码:

setup(
...,
license_files='LICENSE.txt',
...
)

错误:

warning: Failed to find the configured license file 'L'
warning: Failed to find the configured license file 'C'
warning: Failed to find the configured license file 'N'
warning: Failed to find the configured license file 't

【问题讨论】:

标签: python python-3.x setuptools licensing python-wheel


【解决方案1】:

https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html#metadata

Setuptools 官方文档将license_file 的数据类型声明为“str”,license_files 的数据类型为 list-comma

解决方案 1:使用 license_filestr

setup(
...,
license_file='LICENSE.txt',
...
)

解决方案 2a:使用 license_files 和逗号分隔列表

setup(
...,
license_file=LICENSE.txt,
...
)

解决方案 2b setup.cfg 与 license_files

我创建了一个新文件 setup.cfg 并升级了我的 setuptools 以允许它从 setup.cfg 中获取元数据

[metadata]
license_files = <name-of-license-file>

感谢:https://stackoverflow.com/a/48691876/5157515

【讨论】:

  • license_file 确实应该是一个字符串,但是您在问题中使用了license_files。这应该是一个字符串列表,因此是错误。
  • 使用license_file 作为setup 参数将失败并显示消息:UserWarning: Unknown distribution option: 'license_file'license_files 没问题。
猜你喜欢
  • 1970-01-01
  • 2021-05-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-07-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多