Merge simplestreams:drop-py2-packages into simplestreams:master

Proposed by Dan Watkins
Status: Merged
Approved by: Robert C Jennings
Approved revision: 8995610594fa8adb7ab974603708eadd138733af
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: simplestreams:drop-py2-packages
Merge into: simplestreams:master
Diff against target: 32 lines (+3/-2)
3 files modified
tools/js2signed (+1/-1)
tools/sign-examples (+1/-1)
tox.ini (+1/-0)
Reviewer Review Type Date Requested Status
Robert C Jennings (community) Approve
Pat Viafore (community) Approve
Server Team CI bot continuous-integration Approve
Review via email: mp+375984@code.launchpad.net

Commit message

tools/js2signed: change shebang to /usr/bin/env python3

Previously it was using Python 2. This change is to enable Python
3-only package builds.

To post a comment you must log in.
Revision history for this message
Dan Watkins (oddbloke) wrote :

As there are git repo consumers that use this repo in a Python 2-only environment, this is just the minimal change to fix package builds.

Converting the upstream away from Python 2 is a larger piece of work (which has an internal dependency), which is why I've left those as-is for now.

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Scott Moser (smoser) wrote :

You really should fix
 tests/httpserver.py
 tools/j2signed
 tools/make-test-data

having '#!/usr/bin/python' or '#!/usr/bin/env python' is really just making things very unclear, and waiting for something to fail.

you can look at something like 'py2or3' that curtin uses, or the more over-engineered version at https://gist.github.com/smoser/8904199bb8f00a90dd04 .

its a real pain. I'm not sure how other things solve this.

If its acceptable to just drop python2 from all shebangs, then thats probably the easiest thing.

Revision history for this message
Dan Watkins (oddbloke) wrote :

As I said in my previous comment, I'm making the minimal change required to get package builds working. We know that there will be additional work required to fully move to Python 3, which (IIRC) we have scheduled for this cycle.

simplestreams:drop-py2-packages updated
8995610... by Dan Watkins

enable tox to specify the Python version to use in sign-examples

The shebang of js2signed has been updated to Python 3, which means that
sign-examples now runs it using Python 3 by default. sign-examples is
used to setup the tox tests, which means that this change caused the
Python 2 tox environment to fail. As sign-examples is a shell wrapper
for the js2signed Python script, we can't simply invoke it using the
correct Python executable. So, instead, we add the SS_PYTHON
environment variable which allows us to specify which Python executable
to use (whilst still defaulting to using the default shebang if it isn't
set).

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Pat Viafore (patviafore) wrote :

I think at this point all of our tools can take this change, so we're good to go.

review: Approve
Revision history for this message
Robert C Jennings (rcj) wrote :

+1. Patrick changed calling code to explicitly call js2signed with the python2 interpreter where that is still necessary, and that is all complete. I doubled checked his work and checked an environment he does not yet have access to. Thank you Dan.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tools/js2signed b/tools/js2signed
2index b02054b..2b66e5f 100755
3--- a/tools/js2signed
4+++ b/tools/js2signed
5@@ -1,4 +1,4 @@
6-#!/usr/bin/env python
7+#!/usr/bin/env python3
8 # Copyright (C) 2013 Canonical Ltd.
9 #
10 # Author: Scott Moser <scott.moser@canonical.com>
11diff --git a/tools/sign-examples b/tools/sign-examples
12index 9b549d2..89d5dd8 100755
13--- a/tools/sign-examples
14+++ b/tools/sign-examples
15@@ -6,4 +6,4 @@ FILES=( ${TOP_DIR}/examples/*/streams/v1/*.json )
16 force=""
17 [ "$1" = "--force" ] && force="$1"
18
19-"${TOP_DIR}/tools/js2signed" $force "${FILES[@]}"
20+$SS_PYTHON "${TOP_DIR}/tools/js2signed" $force "${FILES[@]}"
21diff --git a/tox.ini b/tox.ini
22index 654652e..3c8634f 100644
23--- a/tox.ini
24+++ b/tox.ini
25@@ -4,6 +4,7 @@ envlist = py27, py3, flake8
26 [testenv]
27 setenv =
28 GNUPGHOME={toxinidir}/gnupg
29+ SS_PYTHON={envpython}
30 commands =
31 {toxinidir}/tools/create-gpgdir
32 {toxinidir}/tools/sign-examples

Subscribers

People subscribed via source and target branches

to all changes: