Merge lp://staging/~ted/snapcraft/python-pip into lp://staging/~snappy-dev/snapcraft/core

Proposed by Ted Gould
Status: Merged
Approved by: Sergio Schvezov
Approved revision: 159
Merged at revision: 178
Proposed branch: lp://staging/~ted/snapcraft/python-pip
Merge into: lp://staging/~snappy-dev/snapcraft/core
Diff against target: 237 lines (+95/-11)
11 files modified
integration-tests/data/pip-requirements/icon.svg (+2/-0)
integration-tests/data/pip-requirements/requirements.txt (+1/-0)
integration-tests/data/pip-requirements/snapcraft.yaml (+14/-0)
integration-tests/units/jobs.pxu (+11/-0)
plugins/python2.yaml (+3/-0)
plugins/python3.yaml (+3/-0)
snapcraft/plugins/python2.py (+25/-0)
snapcraft/plugins/python2_project.py (+2/-5)
snapcraft/plugins/python3.py (+25/-0)
snapcraft/plugins/python3_project.py (+5/-4)
snapcraft/yaml.py (+4/-2)
To merge this branch: bzr merge lp://staging/~ted/snapcraft/python-pip
Reviewer Review Type Date Requested Status
Sergio Schvezov Approve
Review via email: mp+270959@code.staging.launchpad.net

Commit message

Add in support for PIP requirements.txt files in the python plugins.

Description of the change

Add in support for PIP requirements.txt files in the python plugins.

To post a comment you must log in.
149. By Ted Gould

Update to trunk

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

Are you rendering the py3 and py2 examples useless here by removing handle_source options?

I also bring this question up often enough (internally at least); with this implemented in python instead of python-project, what is the reason for python-project (or any .*-project at all?)

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

hey this looks good, it just seems that py2 took a different path than py3.

This also removes the use case (which is rather neat) that the py2-project and py3-project examples bring in.

review: Needs Fixing
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

python2 and python3 for pip is fine fwiw

150. By Ted Gould

Grabbin' trunk

151. By Ted Gould

Put PYTHONPATH in the overall environment instead of a custom one

152. By Ted Gould

Move PYTHONPATH to the env function in Python 2 as well

153. By Ted Gould

Switch python2 to use target as well

Revision history for this message
Ted Gould (ted) wrote :

So, some slight modifications. Switched from --root to --target as it seems in recursive cases that causes "bad things to happen" in that it appends twice. But target doesn't have that problem. Also moved the PYTHONPATH to the standard snapcraft environment handling. Now I can build a Nova snap:

https://github.com/ted-gould/nova/blob/master/snapcraft.yaml

Still would like to figure out if we can fix the command line support in setuptools to not put in the full path in a shebang, but that's not really a pip issue.

Revision history for this message
Sergio Schvezov (sergiusens) :
154. By Ted Gould

Put back a require on python2

155. By Ted Gould

Return the source options to python2 project

Revision history for this message
Ted Gould (ted) wrote :

On Tue, 2015-09-15 at 05:53 +0000, Sergio Schvezov wrote:

> hey this looks good, it just seems that py2 took a different path than py3.
>
> This also removes the use case (which is rather neat) that the py2-project and py3-project examples bring in.

<snip>
I was confused, I didn't see your comments in the diff... handled now.
Thanks!

156. By Ted Gould

Updating to trunk

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

This is what I see when doing

cd examples/webcam-webui
../../bin/snapcraft

...
Building config
python3 setup.py install --install-layout=deb --prefix=/home/sergiusens/source/launchpad.net/snapcraft/examples/webcam-webui/parts/config/install/usr
running install
Checking .pth file support in /home/sergiusens/source/launchpad.net/snapcraft/examples/webcam-webui/parts/config/install/usr/lib/python3/dist-packages/
/home/sergiusens/source/launchpad.net/snapcraft/examples/webcam-webui/parts/python3/install/usr/bin/python3 -E -c pass
TEST FAILED: /home/sergiusens/source/launchpad.net/snapcraft/examples/webcam-webui/parts/config/install/usr/lib/python3/dist-packages/ does NOT support .pth files
error: bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from. The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /home/sergiusens/source/launchpad.net/snapcraft/examples/webcam-webui/parts/config/install/usr/lib/python3/dist-packages/

and your PYTHONPATH environment variable currently contains:

    '/home/sergiusens/source/launchpad.net/snapcraft/examples/webcam-webui/parts/python3/install/usr/lib/python3/dist-packages'

Here are some of your options for correcting the problem:

* You can choose a different installation directory, i.e., one that is
  on PYTHONPATH or supports .pth files

* You can add the installation directory to the PYTHONPATH environment
  variable. (It must then also be on PYTHONPATH whenever you run
  Python and want to use the package(s) you are installing.)

* You can set up the installation directory to support ".pth" files by
  using one of the approaches described here:

  https://pythonhosted.org/setuptools/easy_install.html#custom-installation-locations

Please make the appropriate changes for your system and try again.
Failed doing build for config!

157. By Ted Gould

Updating trunk

158. By Ted Gould

Grab sergio's test

159. By Sergio Schvezov

Environment fixes

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

Nice

review: Approve
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

Thanks! This was a tough one!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: