我是gradle的新手,我想用python创建一个gradle项目,我按照指南编写here并创建项目。 安装不会给我任何问题,但是当我使用命令
运行项目时gradle build
给我这个错误:
..
Install pbr-0.11.0 .................................................. [STARTING]
Processing /home/.../.gradle/caches/modules-2/files-2.1/pypi/pbr/0.11.0/72801e9ffd52e7f438422a3e08b578e906cd270a/pbr-0.11.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-f2i4gbg4-build/setup.py", line 22, in <module>
**util.cfg_to_args())
File "/tmp/pip-f2i4gbg4-build/pbr/util.py", line 261, in cfg_to_args
wrap_commands(kwargs)
File "/tmp/pip-f2i4gbg4-build/pbr/util.py", line 482, in wrap_commands
for cmd, _ in dist.get_command_list():
File "/home/IASuserdev/Desktop/gradleFun/pythonGradle/build/venv/lib/python3.6/site-packages/setuptools/dist.py", line 507, in get_command_list
cmdclass = ep.resolve()
File "/home/IASuserdev/Desktop/gradleFun/pythonGradle/build/venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2297, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/tmp/pip-f2i4gbg4-build/pbr/testr_command.py", line 47, in <module>
from testrepository import commands
ModuleNotFoundError: No module named 'testrepository'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-f2i4gbg4-build
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':installTestRequirements'.
> Failed to install pbr-0.11.0. Please see above output for reason, or re-run your build using ``gradle -i build`` for additional logging.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
我尝试在虚拟环境中使用pip安装testrepository然后我清理并重建项目,但它是一样的。 我读了另一个问题并尝试了所有答案,但没有任何作用,有人可以帮助我吗?
答案 0 :(得分:0)
我在setup.py
中未注释这些行,现在可以正常工作了。
setup(
distclass=GradleDistribution,
package_dir={'': 'src'},
packages=find_packages('src'),
include_package_data=True,
entry_points={
'console_scripts': [
'hello_world = foo.hello:main',
],
}
)
答案 1 :(得分:0)
查看对pygradle issue #246 (Install Requirements Fails, bad pbr version)的评论,它对我有帮助,看起来像您的情况。
通常:
这不是pygradle的问题,但是根据经验,我们知道pbr可能会给人们带来麻烦
因此,只需尝试修复它即可自定义pygradle配置(将 pbr 添加到 setupRequires ),例如:
dependencies {
setupRequires 'pypi:pbr:5.1.1'
}