Re: Updating cmake WITH_PYTHON3 to default ON?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm a bit fuzzy on which distro does what, but I had thought we might
do pure python3 builds for the distros that have already made the leap
(e.g. Ubuntu bionic).  That's kind of a hacky way to get some mixed
python2 vs. python3 testing (assuming we use a mixture of ubuntu and
centos in testing).

Am I being naive to think that we mainly just need to build the python
version that ships with a given distro?  Are there people who would
want e.g. python 3 packages for CentOS 7?

I agree with you in the sense that, if we could somehow include, among the distros that teuthology uses, a distro that does not ship Python 2 at all, then we would get some Python 3 testing out of that.

What makes a distro a "Python 3 distro" is not merely the presence of Python 3, but rather the _absence_ of Python 2 (in the base system). As long as Python 2 is present, there is always the possibility (probability, even) that a given Python script will decide to use it.

There is lots of code out there (not just in Ceph) where Python is called to run a script. Before Python 3 became a thing, calling Python was just a matter of running /usr/bin/python and that's what we still see lots of this code doing.

Now, one would think that with the advent of Python 3, distros would just switch the symlink over. None of this code would need to be changed, because we can assume that /usr/bin/python is:

(a) present, and
(b) a symlink pointing to the preferred Python version on the system.

These are reasonable assumptions, right? Wrong.

What is actually happening is that we can no longer assume that the /usr/bin/python symlink is present. If it _is_ present, it continues to point to /usr/bin/python2 OR it is at least _possible_ that it might be pointing to /usr/bin/python2.

(For Fedora I found http://fedora-python.readthedocs.io/en/latest/plans/default-python-module/ which says that, as of Fedora 28, "users can choose" what /usr/bin/python point to. I have not looked at Ubuntu Bionic at all yet. In openSUSE Leap 15.0, /usr/bin/python points to /usr/bin/python2 but Python 3 can be assumed to be present.)

The upshot of this is that all distro-agnostic code (and we have very little distro-gnostic code) needs to be changed from the straightforward "use /usr/bin/python" to the more nuanced "check for the existence of /usr/bin/python2 and /usr/bin/python3 and behave accordingly", where "behave accordingly" probably now means "prefer python2 if it is present", but in the future should change to "prefer python3 if it is present".

Nathan
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux