2

Snapcraft kept telling me that the python2 plugin was depreciated and that I should be using python instead. So I changed my snapcraft.yaml to use "plugin: python" but now it's trying to interpret the python2 code as python3. Can anyone tell me how to let the python plugin know that I wish to run the code as python 2?

3

From snapcraft help python:

The python plugin can be used for python 2 or 3 based parts.

It can be used for python projects where you would want to do:

  • import python modules with a requirements.txt
  • build a python project that has a setup.py
  • install packages straight from pip

This plugin uses the common plugin keywords as well as those for >"sources". For more information check the 'plugins' topic for the former and the 'sources' topic for the latter.

Additionally, this plugin uses the following plugin-specific keywords:

  • requirements: (string) Path to a requirements.txt file
  • constraints: (string) Path to a constraints file
  • process-dependency-links: (bool; default: false) Enable the processing of dependency links.
  • python-packages: (list) A list of dependencies to get from PyPi
  • python-version: (string; default: python3) The python version to use. Valid options are: python2 and python3

That last option (python-version) is the one in which you're probably interested.

  • Ah - the instructions! Why didn't I think of that? Thanks, adding python-version to the snapcraft.yaml solved my problem. – Darren Oct 17 '16 at 12:18
  • Haha, no problem! – kyrofa Oct 17 '16 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.