前言: 我很清楚 Python 2.7 的状态,我们正在使用的各种库的版本等,并且正在研究升级路径。我们有一个复杂的遗留应用程序,我们不能随意进行更改。因此,为什么我们使用 buildout 来确保一致的安装。除非你能展示一个新版本的包将如何解决这个问题,否则请不要发表关于版本和升级的评论。谢谢。
我们有一个复杂的扩建项目,多年来一直运行良好。但是,在新安装中,两个本身需要其他鸡蛋的鸡蛋不符合这些要求的版本引脚。
这两个包都在其“requires”子句中包含版本约束。
我们已尝试确保首先安装所需鸡蛋的固定版本,但软件包仍会尝试安装最新版本。同一个建筑正在安装数十个鸡蛋,没有任何问题。
虽然我们的构建使用煎蛋来安装鸡蛋,但我们可以在一个非常简单的测试用例中重现它:
[buildout]
parts =
test
index = https://pypi.python.org/simple
[versions]
setuptools_scm = 4.1.2
python-dateutil = 2.7.5
zc.recipe.egg = 2.0.7
[test]
recipe = zc.recipe.egg
eggs =
setuptools_scm
python-dateutil
python-dateutil 的 setup.py 中的需求条款:
requires=["six"],
setup_requires=['setuptools_scm'],
install_requires=["six >=1.5"], # XXX fix when packaging is sane again
运行 buildout -c test.cfg 结果:
Installing test.
Installing 'setuptools_scm', 'python-dateutil'.
We have no distributions for setuptools-scm that satisfies 'setuptools-scm==4.1.2'.
Getting distribution for 'setuptools-scm==4.1.2'.
Fetching setuptools-scm 4.1.2 from: https://files.pythonhosted.org/packages/02/d6/3fb2388faf97942103412838437561f59248086de0e268d98ec3a630ae72/setuptools_scm-4.1.2-py2.7.egg#sha256=b42c150c34d6120babf3646abd7513e032be2e230b3d2034f27404c65aa0c977
Got setuptools-scm 4.1.2.
We have no distributions for python-dateutil that satisfies 'python-dateutil==2.7.5'.
Getting distribution for 'python-dateutil==2.7.5'.
Fetching python-dateutil 2.7.5 from: https://files.pythonhosted.org/packages/0e/01/68747933e8d12263d41ce08119620d9a7e5eb72c876a3442257f74490da0/python-dateutil-2.7.5.tar.gz#sha256=88f9287c0174266bb0d8cedd395cfba9c58e87e5ad86b2ce58859bc11be3cf02
Running easy_install:
"/home/hugh/Projects/eluta/trunk2/lib/python/bin/python2.7" "-c" "import sys; sys.path[0:0] = ['/home/hugh/Projects/eluta/trunk2/lib/python/lib/python2.7/site-packages']; from setuptools.command.easy_install import main; main()" "-mZUNxd" "/home/hugh/Projects/eluta/trunk2/eggs/tmpMuWDfi" "/tmp/tmpPrViTjget_dist/python-dateutil-2.7.5.tar.gz"
path=['/home/hugh/Projects/eluta/trunk2/lib/python/lib/python2.7/site-packages']
Processing python-dateutil-2.7.5.tar.gz
Writing /tmp/easy_install-UoQL8O/python-dateutil-2.7.5/setup.cfg
Running python-dateutil-2.7.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-UoQL8O/python-dateutil-2.7.5/egg-dist-tmp-Tdk8Lr
Traceback (most recent call last):
.
.
.
File "/tmp/easy_install-UoQL8O/python-dateutil-2.7.5/temp/easy_install-EzwsLI/setuptools_scm-7.1.0/setup.py", line 20
def scm_version() -> str:
奇怪的是,setuptools_scm 在 PyPi 上同时出现为 setuptools_scm 和 setuptools-scm,虽然文件名是 setuptools_scm,但版本规范需要是 setuptools-scm,否则它会被忽略。无论如何,我已经为 setuptools_scm 和 setuptools-scm 设置了版本规范,没有任何变化。
虽然我可以想到一些技巧来解决这个问题(例如执行 pip 来安装这两个鸡蛋,因为从 pip 安装它们时不会出现版本问题),但我宁愿找到一个合适的解决方案来解决这个问题,如果尽一切可能。