mirror of https://github.com/open-mmlab/mim.git
refine(commands/install.py): refine check_mim_resources
parent
b51d6a5aaf
commit
e70fa88d64
|
@ -321,7 +321,14 @@ def get_mminstall_from_pypi(mmpkg: str,
|
|||
|
||||
|
||||
def check_mim_resources() -> None:
|
||||
"""Check if the mim resource directory exists."""
|
||||
"""Check if the mim resource directory exists.
|
||||
|
||||
Newer versions of the OpenMMLab package have packaged the mim resource
|
||||
files into the distribution package, while earlier versions do not.
|
||||
|
||||
If the mim resources file (aka `.mim`) do not exists, log a warning that a
|
||||
new version needs to be installed.
|
||||
"""
|
||||
importlib.reload(pip._vendor.pkg_resources)
|
||||
for pkg in pip._vendor.pkg_resources.working_set: # type: ignore
|
||||
pkg_name = pkg.project_name
|
||||
|
@ -333,6 +340,6 @@ def check_mim_resources() -> None:
|
|||
else:
|
||||
installed_path = os.path.join(pkg.location, pkg_name)
|
||||
mim_resources_path = os.path.join(installed_path, '.mim')
|
||||
if os.path.join(mim_resources_path):
|
||||
if not os.path.exists(mim_resources_path):
|
||||
echo_warning(f'mim resources not found: {mim_resources_path}, '
|
||||
f'you can try to install the latest {pkg_name}.')
|
||||
|
|
Loading…
Reference in New Issue