Merge lp:~yashi/snapcraft/snapcraft into lp:~snappy-dev/snapcraft/core

Proposed by Yasushi SHOJI
Status: Superseded
Proposed branch: lp:~yashi/snapcraft/snapcraft
Merge into: lp:~snappy-dev/snapcraft/core
Diff against target: 12 lines (+1/-1)
1 file modified
snapcraft/plugins/python3_project.py (+1/-1)
To merge this branch: bzr merge lp:~yashi/snapcraft/snapcraft
Reviewer Review Type Date Requested Status
Snappy Developers Pending
Review via email: mp+272337@code.launchpad.net

This proposal has been superseded by a proposal from 2015-10-02.

Description of the change

This fixes snapcraft on wily with multiple supported python version, lp:#1499429. The patch takes the least supported version, 3.4, because scanpcraft did not work with python 3.5 on my wily yet.

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

This works but it's a bit weird. Unless there's something I'm missing I'd just use this:

>>> 'python3.4 python3.5'.split()
['python3.4', 'python3.5']

So personally I'd remove the (None, 1) arguments

Revision history for this message
Yasushi SHOJI (yashi) wrote :

On Tue, 29 Sep 2015 19:27:40 +0900,
Zygmunt Krynicki wrote:
>
> This works but it's a bit weird. Unless there's something I'm missing I'd just use this:
>
> >>> 'python3.4 python3.5'.split()
> ['python3.4', 'python3.5']
>
> So personally I'd remove the (None, 1) arguments

Ah, that's just an optimization I use when I just want to pop the head
element from a list. The supported-versions list won't be long, so I
agreee that there is no need for it.

Now how should I go about this? Just force push a new version to the
branch, or create another branch? (apologize for my ignorace about
launchpad workflow.)
--
              yashi

Revision history for this message
Leo Arias (elopio) wrote :

If you still have the bzr folder you used to make this change, you just need to go in there, make the change, bzr commit -m 'Cleaned up the split' && bzr push

Revision history for this message
Leo Arias (elopio) wrote :

I would add this as a comment before the statement you changed:

# py3versions can return more than one version.
# take the first entry of the list. It's ususally the oldest
# supported version available and safer to rely on.

And this needs to be fixed for the python2_project too. If you have time, please make the change in this branch. Otherwise, leave it and we'll make another branch for py2.

Revision history for this message
Leo Arias (elopio) wrote :

Yashi already sent the contributor's agreement.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Please force-push. That would be best.

lp:~yashi/snapcraft/snapcraft updated
210. By Yasushi SHOJI

Handle multiple supported-versions returned by pyversions and py3versions

On Wily with python3-minimal 3.4.3-4ubuntu1,
/usr/share/python3/debian_defaults has multiple version listed in
supported-versions.

 supported-versions = python3.4, python3.5

Those versions return when `py3version -i` is run.

 $ py3versions -i
 python3.4 python3.5

pyversions, with /usr/share/python/debian_defaults, behaves the same.

`pyversions -i` and `py3version -i` is used in snapcraft to generate
PYTHONPATH in Python3ProjectPlugin::python_version(), but due to the
multiple return values separated by a space, it generates the
following PYTHONPATH:

 "....spongeshaker/install/usr/lib/python3.4 python3.5/dist-packages"

and dies with "export: python3.5/dist-packages: bad variable name".

To fix this, just take the first entry of the list. It's usually the
oldest supported version available and safer to rely on.

Unmerged revisions

210. By Yasushi SHOJI

Handle multiple supported-versions returned by pyversions and py3versions

On Wily with python3-minimal 3.4.3-4ubuntu1,
/usr/share/python3/debian_defaults has multiple version listed in
supported-versions.

 supported-versions = python3.4, python3.5

Those versions return when `py3version -i` is run.

 $ py3versions -i
 python3.4 python3.5

pyversions, with /usr/share/python/debian_defaults, behaves the same.

`pyversions -i` and `py3version -i` is used in snapcraft to generate
PYTHONPATH in Python3ProjectPlugin::python_version(), but due to the
multiple return values separated by a space, it generates the
following PYTHONPATH:

 "....spongeshaker/install/usr/lib/python3.4 python3.5/dist-packages"

and dies with "export: python3.5/dist-packages: bad variable name".

To fix this, just take the first entry of the list. It's usually the
oldest supported version available and safer to rely on.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'snapcraft/plugins/python3_project.py'
2--- snapcraft/plugins/python3_project.py 2015-09-23 12:19:45 +0000
3+++ snapcraft/plugins/python3_project.py 2015-09-25 06:58:09 +0000
4@@ -103,7 +103,7 @@
5
6 @property
7 def python_version(self):
8- return self.run_output(['py3versions', '-i'])
9+ return self.run_output(['py3versions', '-i']).split(None, 1)[0]
10
11 # Takes the setup.py file and puts a couple little gems on the
12 # front to make things work better.

Subscribers

People subscribed via source and target branches