From a4ef87f50ef69f2c4ef3ddb98c3f2a586a3aa405 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Mon, 14 Sep 2020 15:55:52 +0100 Subject: [PATCH] Fix python3 compatibility and switch travis to python3 Python2 is EOL. Switch to py3. The move to python3 requires the 'typing' package to be installed. Add it to the travisci file. Also update to 'focal' Ubuntu release to get a python newer than 3.3. This patch reworks the use of git-describe to work out the document version number. The existing code falls over when using Sphinx on Python 3 due to the string datatype changes. Wrap the output of subprocess with str() to fix. Finally, the changebar version build is currently failing and causing latex to stall. Drop it for now until it can be resolved. Signed-off-by: Grant Likely --- .travis.yml | 26 ++++++++++++-------------- source/conf.py | 2 +- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index c6c760a..32233b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ sudo: false -dist: trusty +dist: focal cache: apt: true @@ -15,20 +15,19 @@ git: addons: apt: packages: - - python-pip + - python3-pip - latexmk - libalgorithm-diff-perl - texlive - texlive-latex-extra - texlive-humanities - - texlive-generic-recommended - graphviz - - texlive-generic-extra install: - - pip install --user mako - - pip install --user Sphinx - - pip install --user codespell + - pip3 install --user mako + - pip3 install --user typing + - pip3 install --user Sphinx + - pip3 install --user codespell before_script: - wget https://github.com/ftilmann/latexdiff/releases/download/1.2.1/latexdiff-1.2.1.tar.gz @@ -36,19 +35,18 @@ before_script: - export PATH=$PWD/latexdiff-1.2.1/:$PATH script: - - make check - - git checkout $DIFF_COMMIT + #- git checkout $DIFF_COMMIT + #- make latexpdf + #- mv build/latex build/latex-previous + #- git checkout $TRAVIS_COMMIT - make latexpdf - - mv build/latex build/latex-previous - - git checkout $TRAVIS_COMMIT - - make latexpdf - - make latexdiff + #- make latexdiff - make html - make singlehtml before_deploy: - cp build/latex/devicetree-specification.pdf build/devicetree-specification-$TRAVIS_TAG.pdf - - cp build/latex/devicetree-specification-changebars.pdf build/devicetree-specification-changebars-$TRAVIS_TAG.pdf + #- cp build/latex/devicetree-specification-changebars.pdf build/devicetree-specification-changebars-$TRAVIS_TAG.pdf deploy: - provider: releases diff --git a/source/conf.py b/source/conf.py index c6cddb9..c84edc3 100644 --- a/source/conf.py +++ b/source/conf.py @@ -66,7 +66,7 @@ def setup(app): # # The short X.Y version. try: - version = subprocess.check_output(["git", "describe", "--dirty"]).strip().encode() + version = str(subprocess.check_output(["git", "describe", "--dirty"]), 'utf-8').strip() except: version = "unknown-rev" # The full version, including alpha/beta/rc tags.