gpt4 book ai didi

python - 构建 python 时裤子因 scala 相关错误而失败

转载 作者:太空宇宙 更新时间:2023-11-04 05:44:06 25 4
gpt4 key购买 nike

我正在尝试使用裤子构建一个简单的 pex 来测试它。但是,我遇到了一些问题:

$ ./pants binary src/python/hworld
INFO] Detected git repository at /home/jovalko/pants on branch master

23:03:48 00:00 [main]
(To run a reporting server: ./pants server)
23:03:48 00:00 [bootstrap]
23:03:48 00:00 [setup]
23:03:48 00:00 [parse]
FAILURE:
Failed to resolve target for tool: //:scala-compiler. This target was obtained from
option scalac in scope scala-platform. You probably need to add this target to your tools
BUILD file(s), usually located in BUILD.tools in the workspace root.
Exception AddressLookupError: name 'scala_jar' is not defined
while executing BUILD file FilesystemBuildFile(/home/jovalko/pants/BUILD.tools)
Loading addresses from '' failed.



23:03:48 00:00 [complete]
FAILURE

由于很难将我的所有问题都表达为一个粘贴,我已经发布了它们 on github (为外部链接道歉)。

相关位是我的顶级 BUILD:

# Pants source code
source_root('src/python')

和我的 hworld 二进制文件的 BUILD:

python_binary(name='hworld',
source='hworld.py'
)

也许还有 BUILD.tools 但它很长,我直接从 pantsbuild/pants 复制了它(正如文档中所建议的那样,我从另一个 repo 的工作版本开始)。

我尝试了各种排列(使用 BUILD.tools,没有 pants.ini 中的各种东西)但在每种情况下它都失败了,因为与 scala 相关的东西......这有点令人困惑,因为我只构建 python。而且,在 pantsbuild/pants 存储库中运行对我来说效果很好。

我会提醒您,我是裤子的新手,很可能我做了一些愚蠢的事情;)。有什么想法吗?

最佳答案

为了防止其他人碰到这个问题,我通过从我的 BUILD.tools 中删除与 scala 相关的(特别是任何使用 scala_jar 的东西)条目来解决它:

diff --git a/BUILD.tools b/BUILD.tools
index d0f1cf7..049fb2f 100644
--- a/BUILD.tools
+++ b/BUILD.tools
@@ -23,32 +23,3 @@ jar_library(name = 'scala-repl',
':scala-library',
])

-jar_library(name = 'scalastyle',
- jars = [
- scala_jar(org='org.scalastyle', name='scalastyle', rev='0.3.2')
- ])
-
-jar_library(name = 'scrooge-gen',
- jars = [
- scala_jar(org='com.twitter', name='scrooge-generator', rev='3.20.0',
- excludes=[
- # scrooge requires libthrift 0.5.0-1 which is not available on
- # the default maven repos. Force scrooge to use thrift-0.6.1, which
- # is compatible, instead.
- exclude(org = 'org.apache.thrift', name = 'libthrift')
- ])
- ],
- dependencies = [
- '3rdparty:thrift-0.6.1',
- ])
-
-jar_library(name = 'scrooge-linter',
- jars = [
- scala_jar(org='com.twitter', name='scrooge-linter', rev='3.20.0',
- excludes=[
- exclude(org = 'org.apache.thrift', name = 'libthrift')
- ])
- ],
- dependencies = [
- '3rdparty:thrift-0.6.1',
- ])
diff --git a/src/python/hworld/BUILD b/src/python/hworld/BUILD
index ecfdd58..6407c02 100644
--- a/src/python/hworld/BUILD
+++ b/src/python/hworld/BUILD

关于python - 构建 python 时裤子因 scala 相关错误而失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32878884/

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