summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-10-11 02:00:47 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-10-13 02:02:55 +0900
commitfc6f8fac8331778408905ad484a30ca301d35b97 (patch)
tree7ad61f3407ce8f7f800d6406eb5158eebe89131f
parent2d609ddf581c46fa49b7530b094056c6ed9a5010 (diff)
downloadsphinx-git-fc6f8fac8331778408905ad484a30ca301d35b97.tar.gz
Close #6712: Allow not to install sphinx.testing as runtime (for ALT Linux)
To follow ALT Linux's policy, this enables to work Sphinx without sphinx.testing package.
-rw-r--r--CHANGES1
-rw-r--r--sphinx/util/osutil.py9
2 files changed, 8 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index d3bed243a..7b3b6ef9e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -29,6 +29,7 @@ Bugs fixed
* #6704: linkcheck: Be defensive and handle newly defined HTTP error code
* #6655: image URLs containing ``data:`` causes gettext builder crashed
* #6584: i18n: Error when compiling message catalogs on Hindi
+* #6712: Allow not to install sphinx.testing as runtime (mainly for ALT Linux)
Testing
--------
diff --git a/sphinx/util/osutil.py b/sphinx/util/osutil.py
index f9c7ce6c4..d74ea20fb 100644
--- a/sphinx/util/osutil.py
+++ b/sphinx/util/osutil.py
@@ -22,7 +22,12 @@ from os import path
from typing import Any, Generator, Iterator, List, Tuple
from sphinx.deprecation import RemovedInSphinx30Warning, RemovedInSphinx40Warning
-from sphinx.testing.path import path as Path
+
+try:
+ # for ALT Linux (#6712)
+ from sphinx.testing.path import path as Path
+except ImportError:
+ Path = None # type: ignore
if False:
# For type annotation
@@ -178,7 +183,7 @@ fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
def abspath(pathdir: str) -> str:
- if isinstance(pathdir, Path):
+ if Path is not None and isinstance(pathdir, Path):
return pathdir.abspath()
else:
pathdir = path.abspath(pathdir)