Android 的回购工具失败 python2
Android's repo tool fails with python2
我的 Dockerfile 有 python3
,我得到:
RUN repo init -u https://android.googlesource.com/platform/manifest
---> Running in f3adc38c2aac
/usr/bin/env: 'python': No such file or directory
如果我安装 python
,我会得到这个错误:
Step 6/7 : RUN repo init -u https://android.googlesource.com/platform/manifest
---> Running in 9c03e1b95c0f
repo: warning: Python 2 is no longer supported; Please upgrade to Python 3.6+.
Traceback (most recent call last):
File "/home/project/aosp/.repo/repo/main.py", line 56, in <module>
from subcmds.version import Version
File "/home/project/aosp/.repo/repo/subcmds/__init__.py", line 38, in <module>
['%s' % name])
File "/home/project/aosp/.repo/repo/subcmds/upload.py", line 27, in <module>
from hooks import RepoHook
File "/home/project/aosp/.repo/repo/hooks.py", line 472
file=sys.stderr)
^
SyntaxError: invalid syntax
repo 是这样下载的:
RUN mkdir -p /android_tools \
&& curl https://storage.googleapis.com/git-repo-downloads/repo > /android_tools/repo \
&& chmod a+x /android_tools/repo
https://storage.googleapis.com/git-repo-downloads/repo 至少需要 Python 3.6.
要将 python3
与刚刚下载的 repo
一起使用,您需要修复 shebang 行:
sed -i '1s/python/python3/' /android_tools/repo
我的 Dockerfile 有 python3
,我得到:
RUN repo init -u https://android.googlesource.com/platform/manifest
---> Running in f3adc38c2aac
/usr/bin/env: 'python': No such file or directory
如果我安装 python
,我会得到这个错误:
Step 6/7 : RUN repo init -u https://android.googlesource.com/platform/manifest
---> Running in 9c03e1b95c0f
repo: warning: Python 2 is no longer supported; Please upgrade to Python 3.6+.
Traceback (most recent call last):
File "/home/project/aosp/.repo/repo/main.py", line 56, in <module>
from subcmds.version import Version
File "/home/project/aosp/.repo/repo/subcmds/__init__.py", line 38, in <module>
['%s' % name])
File "/home/project/aosp/.repo/repo/subcmds/upload.py", line 27, in <module>
from hooks import RepoHook
File "/home/project/aosp/.repo/repo/hooks.py", line 472
file=sys.stderr)
^
SyntaxError: invalid syntax
repo 是这样下载的:
RUN mkdir -p /android_tools \
&& curl https://storage.googleapis.com/git-repo-downloads/repo > /android_tools/repo \
&& chmod a+x /android_tools/repo
https://storage.googleapis.com/git-repo-downloads/repo 至少需要 Python 3.6.
要将 python3
与刚刚下载的 repo
一起使用,您需要修复 shebang 行:
sed -i '1s/python/python3/' /android_tools/repo