Edgewall Software

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#12708 closed defect (fixed)

Traceback when single file plugin raises VersionConflict

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.2.1
Component: general Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

VersionConflict and ImportError exceptions from single file plugins are logged at ERROR level. Previously a traceback would result.

API Changes:


A packaged plugin that fails a version requirement such as pkg_resources.require('Trac >= 1.4') results in a log message at ERROR level:

13:40:08 Trac[loader] ERROR: Skipping "tractags = tractags": (version conflict "VersionConflict: (Trac 1.3.2.dev0 (/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git), Requirement.parse('Trac>=1.4'))")

A single file plugin with the same statement results in a traceback:

13:31:06 Trac[loader] ERROR: Failed to load plugin from /Users/rjollos/Documents/Workspace/trac-dev/tracenvs/proj-1.3/plugins/upcomingmilestoneschartmacro.py: 
Traceback (most recent call last):
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/loader.py", line 92, in _load_py_files
    module = imp.load_source(plugin_name, plugin_file)
  File "/Users/rjollos/Documents/Workspace/trac-dev/tracenvs/proj-1.3/plugins/upcomingmilestoneschartmacro.py", line 22, in <module>
    pkg_resources.require('Trac >= 1.4')
  File "/Users/rjollos/Documents/Workspace/trac-dev/pve/lib/python2.7/site-packages/pkg_resources/__init__.py", line 968, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/Users/rjollos/Documents/Workspace/trac-dev/pve/lib/python2.7/site-packages/pkg_resources/__init__.py", line 859, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
VersionConflict: (Trac 1.3.2.dev0 (/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git), Requirement.parse('Trac>=1.4'))

The proposed changes result in:

13:56:26 Trac[loader] ERROR: Skipping "upcomingmilestoneschartmacro": (version conflict "VersionConflict: (Trac 1.3.2.dev0 (/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git), Requirement.parse('Trac>=1.4'))")

Maybe there are other exceptions that are handled for eggs which should be handled for single file plugins?: tags/trac-1.2/trac/loader.py@:48#L36.

Attachments (0)

Change History (6)

comment:1 by Ryan J Ollos, 3 years ago

Release Notes: modified (diff)

Lightly tested changes: log:rjollos.git:t12708_versionconflict_singlefile_plugin. I'll do more investigation before committing, and perhaps also trap ImportErrors.

comment:2 by Ryan J Ollos, 3 years ago

Milestone: next-stable-1.2.x1.2.1
Owner: set to Ryan J Ollos
Status: newassigned

comment:3 by Ryan J Ollos, 3 years ago

Proposed changes in log:rjollos.git:t12708_versionconflict_singlefile_plugin.2.

Simplified error messages to eliminate excess parenthesis and error messages that are redundant with the exception name, like version conflict "VersionConflict: ....

Example from before changes:

18:06:02 Trac[loader] ERROR: Skipping "RaiseErrorPlugin": (version conflict "VersionConflict: (Trac 1.2.1.dev0 (/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git), Requirement.parse('Trac>=1.4'))")

comment:4 by Ryan J Ollos, 3 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to 1.2-stable in r15616, merged to trunk in r15617.

comment:5 by Jun Omae, 3 years ago

Sorry for delay response. I don't consider we should use Loading plugin … for it about the following change in [15616].

-                env.log.debug("Adding plugin %s from %s", dist, dist.location)
+                env.log.debug('Loading plugin "%s" from "%s"',
+                              dist, dist.location)

working_set.add() just adds plugin to load and the plugin isn't loaded yet.

Last edited 3 years ago by Jun Omae (previous) (diff)

comment:6 by Ryan J Ollos, 3 years ago

Fixed in r15620, merged in r15621.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to as closed The owner will be changed from Ryan J Ollos to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.