Skip to contentSkip to conversation

Fix python3 compatibility for sphinx conf.py

PATCH New Rob Herring 1 participant 1 message Mar 5, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix python3 compatibility for sphinx conf.py

In python3, subprocess.check_output() returns a bytearray. We need to encode this into a string type for 'version' and fix this error:

Configuration error:
There is a programmable error in your configuration file:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/sphinx/config.py", line 368, in eval_config_file
execfile_(filename, namespace)
File "/usr/lib/python3/dist-packages/sphinx/util/pycompat.py", line 150, in execfile_
exec_(code, _globals)
File "/home/rob/proj/git/devicetree-specification/source/conf.py", line 260, in <module>
if '-' in release:
TypeError: a bytes-like object is required, not 'str'

---
 source/conf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
source/conf.py +1 -1
index 3f5cc2c27538..c6cddb9afa3a 100644
@@ -66,7 +66,7 @@ author = u'devicetree.org'
 #
 # The short X.Y version.
 try:
-    version = subprocess.check_output(["git", "describe", "--dirty"]).strip()
+    version = subprocess.check_output(["git", "describe", "--dirty"]).strip().encode()
 except:
     version = "unknown-rev"
 # The full version, including alpha/beta/rc tags.
Signature · 1 line
2.20.1