我首先研究了在 Github 上找到的几个要点:https://gist.github.com/lpetre/87a5196d14cf4484f1f2 https://gist.github.com/lpetre/87a5196d14cf4484f1f2
这在我的笔记本电脑上运行得很好,但是我正在尝试设置 Travis-CI 以自动构建发布 APK 并将其提交到 Play 商店。我现在遇到的问题是在 Travis 方面,因为我无法使用 pip 安装 google_api_python_client。
接到电话后,我得到以下信息:
Installing collected packages: google-api-python-client, httplib2
Running setup.py install for google-api-python-client
error: could not create '/usr/local/lib/python2.7/dist-packages/apiclient': Permission denied
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_travis/google-api-python-client/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ctZKCR-record/install-record.txt --single-version-externally-managed --compile:
所以我放弃使用 pip,自己下载了 python 客户端库,现在将它们包含在我的 git 存储库中(在 /google_api_upload 下)。
Google 的 API 上传客户端库说明的一部分(https://github.com/googlesamples/android-play-publisher-api/blob/master/v2/python/README.md https://github.com/googlesamples/android-play-publisher-api/blob/master/v2/python/README.md)说在 python 控制台中运行“import apiclient”(同样,在我的笔记本电脑上运行良好,但在 travis 上不行,因为据我所知,我无法启动 python 会话并输入“import apiclient”;它只是挂在 python 会话上)。
所以我想在我的 gradle 文件中包含一个 Gradle 函数来调用 API 函数并从 travis.yml 文件中调用会很棒;但我什至不知道这是否可能。
因此,任何输入都会有所帮助,特别是:
- 我在 travis 上运行 pip 的尝试是否搞砸了?我可以 sudo 来提升权限吗(我想我不能)
- 有没有办法在 travis.yml 文件的一行中调用 python 的“import apiclient”?
- 是否可以让 travis 调用一个 gradle 函数来引用我的构建中包含的客户端库?
- 我试图找到这个端到端过程的示例,但还没有找到任何适合这种情况的示例,您知道吗?
Thanks!