Skip to content

docs/xhive: support both python2 and python3

Marek Szuba requested to merge build_docs_python3 into version/2.5

Created by: mkszuba

Use case

See ENSCORESW-3081: Read the Docs is now actively pushing towards using Python3 for documentation building, the custom modules we use in the process are Python2-specific, and we would like to make the switch before RtD drop Python2 support - which is likely to happen sooner rather than later because Python2.7 reaches end of life in 2020.

Description

Adapt Python2-specific code in our custom documentation-building modules so that it works with both Python2 and Python3. This is done in a Python3-centric way in order to minimise the effort of dropping Python2 support once we have decided to do so.

Possible Drawbacks

Slight overhead incurred by cross-version compatibility code. Temporary files are no longer opened in binary mode so there is a risk of the code no longer working as expected under Windows, assuming it has ever worked under Windows.

Testing

Have you added/modified unit tests to test the changes?

No

If so, do the tests pass/fail?

n/a

Have you run the entire test suite and no regression was detected?

I have successfully built HTML documentation using updated code under both Python2.7 and Python3.6. Haven't tried 3.7 but as far as I can see in the documentation, none of the changes between 3.6 and 3.7 are relevant to us.

Merge request reports