Opened 9 years ago
Last modified 6 years ago
#12158 closed defect
Skipped classes can be loaded, activated and displayed on plugin admin page — at Initial Version
Reported by: | Ryan J Ollos | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 1.2.3 |
Component: | general | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Issue was found when making changes to trac-github plugin. The entry_points
configuration for the plugin was changed to:
extras_require={'oauth': ['requests_oauthlib >= 0.5']}, entry_points={'trac.plugins': [ 'github.browser = tracext.github:GitHubBrowser', 'github.loginmodule = tracext.github:GitHubLoginModule[oauth]', 'github.postcommithook = tracext.github:GitHubPostCommitHook', ]},
The GitHubLoginModule
still shows on the Plugins admin page when the dependency is not satisfied. The component can be activated when requests-oauthlib
is not installed even though it was claimed to be skipped during environment startup.
02:22:27 AM Trac[loader] DEBUG: Skipping "github.auth = tracext.github:GitHubLoginModule [oauth]": ("DistributionNotFound: requests-oauthlib>=0.5" not found) 02:22:27 AM Trac[loader] DEBUG: Loading github.browser from /home/user/Workspace/trac-github-dev/pve/lib/python2.7/site-packages/trac_github-2.1.3-py2.7.egg 02:22:27 AM Trac[loader] DEBUG: Loading github.postcommithook from /home/user/Workspace/trac-github-dev/pve/lib/python2.7/site-packages/trac_github-2.1.3-py2.7.egg
The issue seems to be that since the dependency is a method-scoped import, the GitHubLoginModule
class is added to the Component registry when other classes in the module are loaded: tags/trac-1.0.8/trac/loader.py@:68#L36. Primarily it would be nice to not show the Component on the plugin admin page when it is claimed to be skipped.
I don't know if there's a reasonable solution to this, but I just thought I would raise the issue to see if there are any ideas.