mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-12-13 14:43:03 +00:00
improvement: don't crash on unloadable plugins
In some cases, plugins declare an entry point but cannot be loaded. This is the case when they depend on a version of tutor that is not the one that is currently installed. This use case is very frequent when working on multiple versions at the same time (i.e: right now, while we are working on the Maple release). In such cases, it's best just to ignore the plugin entirely rather than having to re-install all plugins in the virtualenv.
This commit is contained in:
parent
0a2abe32dc
commit
d9d08ad0f7
@ -4,6 +4,8 @@ Note: Breaking changes between versions are indicated by "💥".
|
||||
|
||||
## Unreleased
|
||||
|
||||
- [Improvement] Ignore Python plugins which cannot be loaded.
|
||||
|
||||
## v12.1.6 (2021-11-02)
|
||||
|
||||
- [Improvement] Upgrade all services to open-release/lilac.3.
|
||||
|
@ -231,14 +231,18 @@ class EntrypointPlugin(BasePlugin):
|
||||
def iter_load(cls) -> Iterator["EntrypointPlugin"]:
|
||||
for entrypoint in pkg_resources.iter_entry_points(cls.ENTRYPOINT):
|
||||
try:
|
||||
error: Optional[str] = None
|
||||
yield cls(entrypoint)
|
||||
except:
|
||||
except pkg_resources.VersionConflict as e:
|
||||
error = e.report()
|
||||
except Exception as e:
|
||||
error = str(e)
|
||||
if error:
|
||||
fmt.echo_error(
|
||||
"Failed to load entrypoint '{} = {}' from distribution {}".format(
|
||||
entrypoint.name, entrypoint.module_name, entrypoint.dist
|
||||
"Failed to load entrypoint '{} = {}' from distribution {}: {}".format(
|
||||
entrypoint.name, entrypoint.module_name, entrypoint.dist, error
|
||||
)
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
class OfficialPlugin(BasePlugin):
|
||||
|
Loading…
Reference in New Issue
Block a user