使用setuptools == 27.2.0,我们的picca软件包(https://github.com/igmhub/picca)的travis测试效果很好。使用最新版本的setuptools == 41.0.0:https://github.com/igmhub/picca/issues/591不再是这种情况。
该问题似乎与setuptools尝试读取脚本的位置有关。 我收到以下错误:
Traceback (most recent call last):
File "/home/travis/virtualenv/python3.6.3/bin/picca_deltas.py", line 4, in <module>
__import__('pkg_resources').run_script('picca==4.0', 'picca_deltas.py')
File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 666, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1437, in run_script
.format(**locals()),
pkg_resources.ResolutionError: Script 'scripts/picca_deltas.py' not found in metadata at '/home/travis/build/igmhub/picca/py/picca.egg-info'
当寻找路径/home/travis/build/igmhub/picca/py/picca.egg-info/
时,实际上没有scripts
文件夹。
我们的python设置如下,我们应该更改一些内容,以便设置工具知道在哪里找到脚本?
#!/usr/bin/env python
import glob
from setuptools import setup
scripts = glob.glob('bin/*')
description = "Package for Igm Cosmological-Correlations Analyses"
version="4.0"
setup(name="picca",
version=version,
description=description,
url="https://github.com/igmhub/picca",
author="<***>",
author_email="<***>",
packages=['picca','picca.fitter2'],
package_dir = {'': 'py'},
package_data = {'picca': ['fitter2/models/*/*.fits']},
install_requires=['numpy','scipy','iminuit','healpy','fitsio',
'llvmlite','numba','h5py','future','setuptools'],
test_suite='picca.test.test_cor',
scripts = scripts
)
命令/home/travis/virtualenv/python3.6.3/bin/picca_deltas.py
在我的计算机上如下所示:
#!<where is python>/python/3.6.3/bin/python
# EASY-INSTALL-SCRIPT: 'picca==4.0','picca_deltas.py'
__requires__ = 'picca==4.0'
__import__('pkg_resources').run_script('picca==4.0', 'picca_deltas.py')
感谢您的帮助。
答案 0 :(得分:0)
这是一个疯狂的镜头,但我只是遇到了同样的问题。
看看/home/travis/build/igmhub/picca/py/picca.egg-info
看起来像您的构建文件夹。它不应该查看build文件夹中的egg-info信息,而是要查看您安装的那个信息。
只需更改目录,就可以了:
cd .. # or cd anywhere outside your build folder
picca_deltas.py
应该工作正常。
答案 1 :(得分:0)
我找到了一个修复程序,现在我使用pytest
而不是python setup.py test
运行测试。
https://github.com/igmhub/picca/pull/698/files。
线索在以下消息中;
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.