-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert to dh-virtualenv.deb
to python 3
#300
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).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thanks a lot for the work but here, and sorry for ths review dragging.
Quite symbolic btw that the PR that makes this Python 3 compatible is #300 😁
from dh_virtualenv import Deployment | ||
from dh_virtualenv.cmdline import get_default_parser | ||
from dh_virtualenv.debhelper import DebHelper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 👍
@@ -38,7 +35,7 @@ log = logging.getLogger(__name__) | |||
def _shell_vars(**kwargs): | |||
"""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())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm honestly baffled that there isn't more python2-isms in this code 😁
Once more, thanks a lot, and really happy to merge this and make dh-virtualenv work on python3 only environments 😊 |
Upstream have merged our changes (spotify/dh-virtualenv#300), so let's switch back to it instead of using our fork.
Upstream have merged our changes (spotify/dh-virtualenv#300), so let's switch back to it instead of using our fork.
Upstream have merged our changes (spotify/dh-virtualenv#300), so let's switch back to it instead of using our fork.
As we all know, python2.7 is out of support, and Debian are removing support for it. In particular,
python-mock
andpython-sphinx
have both been removed from the Debian repositories fortesting
andunstable
, meaning that it is impossible to satisfy theBuild-Depends
fordh-virtualenv
on those distributions.Likewise, Debian are removing support for
debpython
-dh-python
superceded it a long time ago.The long and the short of it is that we need to switch
dh-virtualenv
to run under python3 rather than python2. (Note thatdh-virtualenv
will 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-virtualenv
Import
debhelper.py
into 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.deb
to use thepybuild
buildsystem. 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.