Blob Blame History Raw
From 46b2192c1c146bffda04ffe696a8934015af5777 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Mon, 13 May 2019 10:48:03 +0200
Subject: [PATCH] Build docs with Python 3

Fixes https://github.com/WoLpH/python-utils/issues/6
---
 docs/conf.py | 4 +++-
 tox.ini      | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 6f1ccba..f2225c5 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -67,7 +67,7 @@
 
 # Monkey patch to disable nonlocal image warning
 import sphinx
-if hasattr(sphinx, 'environment'):
+try:
     original_warn_mode = sphinx.environment.BuildEnvironment.warn_node
 
     def allow_nonlocal_image_warn_node(self, msg, *args, **kwargs):
@@ -76,6 +76,8 @@ def allow_nonlocal_image_warn_node(self, msg, *args, **kwargs):
 
     sphinx.environment.BuildEnvironment.warn_node = \
         allow_nonlocal_image_warn_node
+except AttributeError:
+    pass
 
 suppress_warnings = [
     'image.nonlocal_uri',
diff --git a/tox.ini b/tox.ini
index 33b165c..b588f0a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -19,7 +19,7 @@ deps = flake8
 commands = flake8 --ignore=W391 python_utils {posargs}
 
 [testenv:docs]
-basepython = python2.7
+basepython = python3
 whitelist_externals =
     rm
     cd