3

I started by looking into a couple of Gists I found on Github: https://gist.github.com/lpetre/87a5196d14cf4484f1f2

And this works great on my laptop, however I'm trying to set up Travis-CI to automatically build the release APK and submit it to the Play Store. The issue that I'm encountering now is on the Travis side, in that I cannot use pip to install the google_api_python_client.

upon that call, I get the following:

 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:

So I strayed away from using pip, downloaded the python client libraries on their own, and am now including them in my git repo (under /google_api_upload).

A part of Google's API Upload client library instructions (https://github.com/googlesamples/android-play-publisher-api/blob/master/v2/python/README.md) say to run "import apiclient" in a python console (again, works fine on my laptop, but not travis because I can't start a python session and enter in "import apiclient" so far as I've found; it just hangs on the python session).

So then I figured it'd be awesome to just have a Gradle function in my gradle files which calls the API functions, and is called from the travis.yml file; but I don't even know if that's possible.

So any input would help, notably:

  • Did I mess up in my attempt at running pip on travis? Can I sudo to elevate permissions for this (I imagine I can't)
  • Is there a way to call "import apiclient" for python within a single line in the travis.yml file?
  • Is it possible to have travis call a gradle function which refers to client libraries included in my build?
  • I've tried to find examples of this end-to-end process, but haven't found any that fit this exact case, do you know of any?

Thanks!

Adam
  • 1,076
  • 1
  • 11
  • 24

2 Answers2

2

I had similar error message

error: could not create '/usr/local/lib/python2.7/dist-packages/googleapiclient': Permission denied

and fixed that by adding sudo:

sudo pip install google-api-python-client

Compare build #162 and #163.

MaciejGórski
  • 22,187
  • 7
  • 70
  • 94
0

Got a response from Travis support, but have not confirmed yet.

I believe this is an issue reported in https://github.com/travis-ci/travis-ci/issues/2280. https://github.com/travis-ci/travis-ci/issues/2280#issuecomment-42798869 suggests that adding "mvn -pl extras/google-play-services install" should do the trick.

Adam
  • 1,076
  • 1
  • 11
  • 24