提交 7efd1c59 authored 作者: Ben Mares's avatar Ben Mares 提交者: Ricardo Vieira

Get rid of pydot-ng because it's deprecated since 7 years

上级 73c0d4d7
......@@ -78,7 +78,7 @@ tests = [
"pytest-mock",
"pytest-sphinx",
]
rtd = ["sphinx>=5.1.0,<6", "pygments", "pydot", "pydot2", "pydot-ng"]
rtd = ["sphinx>=5.1.0,<6", "pygments", "pydot"]
jax = ["jax", "jaxlib"]
numba = ["numba>=0.57", "llvmlite"]
......
......@@ -1188,45 +1188,21 @@ default_colorCodes = {
def _try_pydot_import():
pydot_imported = False
pydot_imported_msg = ""
try:
# pydot-ng is a fork of pydot that is better maintained
import pydot_ng as pd
if pd.find_graphviz():
pydot_imported = True
else:
pydot_imported_msg = "pydot-ng can't find graphviz. Install graphviz."
except ImportError:
try:
# fall back on pydot if necessary
import pydot as pd
if hasattr(pd, "find_graphviz"):
if pd.find_graphviz():
pydot_imported = True
else:
pydot_imported_msg = "pydot can't find graphviz"
else:
pd.Dot.create(pd.Dot())
pydot_imported = True
return pd
except ImportError:
# tests should not fail on optional dependency
pydot_imported_msg = (
"Install the python package pydot or pydot-ng. Install graphviz."
)
extra_msg = ""
except Exception as e:
pydot_imported_msg = "An error happened while importing/trying pydot: "
pydot_imported_msg += str(e.args)
extra_msg = f"\nAn error happened while importing/trying pydot: {e!r}"
if not pydot_imported:
raise ImportError(
"Failed to import pydot. You must install graphviz "
"and either pydot or pydot-ng for "
f"`pydotprint` to work:\n {pydot_imported_msg}",
"Failed to import pydot. You must install graphviz and pydot for "
f"`pydotprint` to work.{extra_msg}",
)
return pd
def pydotprint(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论