Actions
Feature #8499
closedadd python 3 support for python scripts
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
% Done:
0%
Source:
other
Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:
Description
As more distributions start supporting python 3 (and in some cases Python 3 only) it is becoming quite problematic to
just rely on lines like:
#!/usr/bin/env python
When distros start supporting python 3, scripts are expected to specify python 2 with:
#!/usr/bin/env python2
However, this is an incompatible way to specify the python version as systems that ship with python 2
will break on that line.
Some opinions from the community are:
- Port everything to Go (or something with no dependencies)
- Package/embed a Python interpreter of our choosing (e.g. Python 2.7) to work for our scripts
My suggestion is to do a single code-base that supports 2.6, 2.7, and 3.4.
It is not that difficult to do so, and there would need to be 2 requirements for this to happen:
- a test harness where we can add more/different interpreters to test against (making sure the same
code works for all the versions we want to support). This is already somewhat in place for
ceph-brag (see src/test/python/) and more to come with #8458
- a library that has reusable common modules that work correctly independently of the python version. This is kind
of what the `six` library does, and we would either need to include `six` with Ceph and allow us to import from it
or have one of our own with our very specific needs.
Actions