mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #6728 from tk0miya/6712_optional_Path_import
Close #6712: Allow not to install sphinx.testing on ALT Linux
This commit is contained in:
commit
f59ebed3bd
1
CHANGES
1
CHANGES
@ -33,6 +33,7 @@ Bugs fixed
|
|||||||
* #6584: i18n: Error when compiling message catalogs on Hindi
|
* #6584: i18n: Error when compiling message catalogs on Hindi
|
||||||
* #6708: mathbase: Some deprecated functions have removed
|
* #6708: mathbase: Some deprecated functions have removed
|
||||||
* #6709: autodoc: mock object does not work as a class decorator
|
* #6709: autodoc: mock object does not work as a class decorator
|
||||||
|
* #6712: Allow not to install sphinx.testing as runtime (mainly for ALT Linux)
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
@ -22,7 +22,12 @@ from os import path
|
|||||||
from typing import Any, Generator, Iterator, List, Tuple
|
from typing import Any, Generator, Iterator, List, Tuple
|
||||||
|
|
||||||
from sphinx.deprecation import RemovedInSphinx30Warning, RemovedInSphinx40Warning
|
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:
|
if False:
|
||||||
# For type annotation
|
# For type annotation
|
||||||
@ -178,7 +183,7 @@ fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
|
|||||||
|
|
||||||
|
|
||||||
def abspath(pathdir: str) -> str:
|
def abspath(pathdir: str) -> str:
|
||||||
if isinstance(pathdir, Path):
|
if Path is not None and isinstance(pathdir, Path):
|
||||||
return pathdir.abspath()
|
return pathdir.abspath()
|
||||||
else:
|
else:
|
||||||
pathdir = path.abspath(pathdir)
|
pathdir = path.abspath(pathdir)
|
||||||
|
Loading…
Reference in New Issue
Block a user