Convert to dh-virtualenv.deb to python 3#300
Merged
nailor merged 5 commits intospotify:masterfrom Jun 2, 2020
Merged
Conversation
iteritems doesn't exist in python 3.
This seems to have been removed from debian in recent versions, and it's not that big, so let's just bring it in here.
pybuild is a replacement for `python_distutils`, which requires python2. pybuild is part of `dh-python`, so it will be available wherever our build deps are installed. See also: * https://wiki.debian.org/Python/LibraryStyleGuide#Overview * https://wiki.debian.org/Python/Pybuild
Switch to using python 3 for building the dh-virtualenv deb. Python2 is dead, and the existing build fails for Ubuntu 20.04 and debian testing (specifically, python-mock and python-sphinx no longer exist).
nailor
approved these changes
Jun 2, 2020
| from debpython.debhelper import DebHelper | ||
| from dh_virtualenv import Deployment | ||
| from dh_virtualenv.cmdline import get_default_parser | ||
| from dh_virtualenv.debhelper import DebHelper |
Collaborator
There was a problem hiding this comment.
Btw, maybe I should have vendored this in earlier, the sys path trickery has always been... not so nice, and this is so much cleaner 👍
| """Convert the given values into the equivalent shell snippet defining them.""" | ||
| return '\n'.join("dh_venv_{0}='{1}'".format(k, v.replace("'", r"'\''")) | ||
| for k, v in sorted(kwargs.iteritems())) | ||
| for k, v in sorted(kwargs.items())) |
Collaborator
There was a problem hiding this comment.
I'm honestly baffled that there isn't more python2-isms in this code 😁
Collaborator
|
Once more, thanks a lot, and really happy to merge this and make dh-virtualenv work on python3 only environments 😊 |
richvdh
added a commit
to matrix-org/synapse
that referenced
this pull request
Jun 3, 2020
Upstream have merged our changes (spotify/dh-virtualenv#300), so let's switch back to it instead of using our fork.
richvdh
added a commit
to matrix-org/synapse
that referenced
this pull request
Jun 3, 2020
Upstream have merged our changes (spotify/dh-virtualenv#300), so let's switch back to it instead of using our fork.
This was referenced Jun 5, 2020
This was referenced Jun 10, 2020
Closed
phil-flex
pushed a commit
to phil-flex/synapse
that referenced
this pull request
Jun 16, 2020
Upstream have merged our changes (spotify/dh-virtualenv#300), so let's switch back to it instead of using our fork.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As we all know, python2.7 is out of support, and Debian are removing support for it. In particular,
python-mockandpython-sphinxhave both been removed from the Debian repositories fortestingandunstable, meaning that it is impossible to satisfy theBuild-Dependsfordh-virtualenvon those distributions.Likewise, Debian are removing support for
debpython-dh-pythonsuperceded it a long time ago.The long and the short of it is that we need to switch
dh-virtualenvto run under python3 rather than python2. (Note thatdh-virtualenvwill still be able to build other packages to run under python2.)To get there, we need to do a few things:
Fix a tiny python3-incompatibility in
dh-virtualenvImport
debhelper.pyinto the dh-virtualenv tree, since debpython has been removed. (There's a different version indh-python, but it's a bit specific todh-python, and it's not a large module).change the debian rules for
dh-virtualenv.debto use thepybuildbuildsystem. The default buildsystem for python projects (python_distutils) is deprecated and relies on stuff in the python2 packages which we'd rather avoid.Finally, replace the dependencies with python3 equivalents, and build the package with dh-python3 instead of dh-python2.
Hey presto, dh-virtualenv will run under python 3 instead of python 2.
I've tested this on a range of distributions including Ubuntu Xenial and Focal, and Debian Sid and Stretch.
Fixes #284, #296, #297 and #298.