gpt4 book ai didi

python - buildout.cfg 中的版本范围

转载 作者:行者123 更新时间:2023-11-30 23:17:57 27 4
gpt4 key购买 nike

我有一个项目,我想维护 Django 1.7 的最新稳定版本(目前为 1.7.1,但这可能会改变)。

setup.py中,我指定了如下所示的版本范围:

setup(
# ...
install_requires = ['setuptools',
'django >= 1.7, < 1.8',
],
)

buildout.cfg 中,我指定了相同的内容:

[versions]
django = >= 1.7, < 1.8
ipython = >= 2.3.1, < 3.0.0

对于ipython,这非常有效,但不幸的是 Django 似乎不喜欢它:

Got Django 1.7.1.
Uninstalling ipython_section.
Installing python_section.
While:
Installing python_section.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/zc/buildout/buildout.py", line 1942, in main
getattr(buildout, command)(args)
File "/usr/local/lib/python2.7/dist-packages/zc/buildout/buildout.py", line 622, in install
installed_files = self[part]._call(recipe.install)
File "/usr/local/lib/python2.7/dist-packages/zc/buildout/buildout.py", line 1366, in _call
return f()
File "/home/tk/thunderdome/eggs/zc.recipe.egg-2.0.1-py2.7.egg/zc/recipe/egg/egg.py", line 126, in install
reqs, ws = self.working_set()
File "/home/tk/thunderdome/eggs/zc.recipe.egg-2.0.1-py2.7.egg/zc/recipe/egg/egg.py", line 84, in working_set
allow_hosts=self.allow_hosts)
File "/usr/local/lib/python2.7/dist-packages/zc/buildout/easy_install.py", line 812, in install
return installer.install(specs, working_set)
File "/usr/local/lib/python2.7/dist-packages/zc/buildout/easy_install.py", line 644, in install
requirement = self._constrain(requirement)
File "/usr/local/lib/python2.7/dist-packages/zc/buildout/easy_install.py", line 603, in _constrain
requirement = _constrained_requirement(constraint, requirement)
File "/usr/local/lib/python2.7/dist-packages/zc/buildout/easy_install.py", line 1400, in _constrained_requirement
_constrained_requirement_constraint(constraint, requirement)
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2786, in parse
reqs = list(parse_requirements(s))
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2714, in parse_requirements
"version spec")
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2679, in scan_list
raise ValueError(msg, line, "at", line[p:])
ValueError: ('Expected version spec in', 'django[]>=1.7,,>=1.7,<1.8', 'at', ',>=1.7,<1.8')

为什么会失败,我该如何修复它?

最佳答案

带有 something = <= 1234 的版本规范无效。 =<= 都不是正确的语法。

我会以不同的方式处理这个问题。您已经使用 setup.pyinstall_requires 来限制构建 1.7 和 1.8 之间的版本。构建将尊重该要求,因此您无需在构建配置中重复它。

构建版本固定的用途正是:固定到一个特定版本。您要么让 buildout 选择它想要的内容,要么告诉它选择一个确切的版本。

我使用的方式是在show-picked-versions = true部分添加一个[buildout]选项。然后 Buildout 将打印出它选择的版本列表。然后我将该列表复制/粘贴到 [versions] 。这样您就可以获得可重复的构建良好的速度提升,因为构建不需要再次在 pypi 中搜索这些版本。

关于python - buildout.cfg 中的版本范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27048599/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com