Skip to content

Commit 687b54e

Browse files
committed
🐛 fix(alembic): don't get dist by top-level package
1 parent e688568 commit 687b54e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

nonebot_plugin_orm/utils.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> Iterable[_T]:
181181
_packages_distributions = lru_cache(None)(packages_distributions)
182182

183183

184-
# https://github.com/pdm-project/pdm/blob/fee1e6bffd7de30315e2134e19f9a6f58e15867c/src/pdm/utils.py#L361-L374
185184
def is_editable(plugin: Plugin) -> bool:
186185
"""Check if the distribution is installed in editable mode"""
187186
while plugin.parent_plugin:
@@ -193,11 +192,13 @@ def is_editable(plugin: Plugin) -> bool:
193192
with suppress(PackageNotFoundError):
194193
dist = distribution(plugin.metadata.name)
195194

196-
if not dist:
197-
with suppress(KeyError, IndexError):
198-
dist = distribution(
199-
_packages_distributions()[plugin.module_name.split(".")[0]][0]
200-
)
195+
# XXX: 有些包有不正确的 top_level.txt (例如: kiwisolver 的 src),
196+
# 导致下面的代码有可能得出错误的结果. 参见: https://github.com/nucleic/kiwi/issues/169
197+
# if not dist:
198+
# with suppress(KeyError, IndexError):
199+
# dist = distribution(
200+
# _packages_distributions()[plugin.module_name.split(".")[0]][0]
201+
# )
201202

202203
if not dist:
203204
path = files(plugin.module)

0 commit comments

Comments
 (0)