From c5e56fb2b28366a37519a550de894bc55da4fec5 Mon Sep 17 00:00:00 2001
From: Yuya Nishihara <yuya@tcha.org>
Date: Wed, 5 May 2021 11:11:21 +0900
Subject: [PATCH] import ENOENT from errno module (fixes #56)

AFAIK, ENOENT exists on Windows, so we don't need a compat module. We could
also switch to FileNotFoundError type if we've dropped support for Python 2.
---
 sphinxcontrib/plantuml.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sphinxcontrib/plantuml.py b/sphinxcontrib/plantuml.py
index 4edaf53..22a1588 100644
--- a/sphinxcontrib/plantuml.py
+++ b/sphinxcontrib/plantuml.py
@@ -21,7 +21,7 @@
     from sphinx.util.compat import Directive
 except ImportError:
     from docutils.parsers.rst import Directive
-from sphinx.util.osutil import ensuredir, ENOENT
+from sphinx.util.osutil import ensuredir
 
 try:
     from PIL import Image
@@ -107,7 +107,7 @@
                                  stdout=f, stdin=subprocess.PIPE,
                                  stderr=subprocess.PIPE)
         except OSError as err:
-            if err.errno != ENOENT:
+            if err.errno != errno.ENOENT:
                 raise
             raise PlantUmlError('plantuml command %r cannot be run'
                                 % self.builder.config.plantuml)
@@ -248,7 +248,7 @@
             p = subprocess.Popen(['bash'] + args, stdout=subprocess.PIPE,
                                  stderr=subprocess.PIPE)
     except OSError as err:
-        if err.errno != ENOENT:
+        if err.errno != errno.ENOENT:
             raise
         raise PlantUmlError('epstopdf command %r cannot be run'
                             % self.builder.config.plantuml_epstopdf)
