#12294 closed enhancement (fixed)
System Information should be a unique list
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.10 |
Component: | general | Version: | |
Severity: | normal | Keywords: | system |
Cc: | Branch: | ||
Release Notes: |
Duplicate entries returned by |
||
API Changes: |
|
||
Internal Changes: |
Description
While working on #12287 it occurred that two plugins might add the same package via System Information. The proposed change will make the System Information list unique.
-
trac/env.py
diff --git a/trac/env.py b/trac/env.py index fb08ff6..63cf53b 100644
a b class Environment(Component, ComponentManager): 303 303 info = self.systeminfo[:] 304 304 for provider in self.system_info_providers: 305 305 info.extend(provider.get_system_info() or []) 306 info.sort(key=lambda (name, version): (name != 'Trac', name.lower()))307 return info306 return sorted(set(info), 307 key=lambda (name, ver): (name != 'Trac', name.lower())) 308 308 309 309 # ISystemInfoProvider methods 310 310
Attachments (0)
Change History (3)
comment:2 by , 9 years ago
API Changes: | modified (diff) |
---|---|
Release Notes: | modified (diff) |
Resolution: | → fixed |
Status: | assigned → closed |
In [14405], name
attribute added to dictionary returned by get_pkginfo
.
Other changes committed to 1.0-stable in [14406,14408:14409], merged to trunk in [14407,14410].
comment:3 by , 9 years ago
API Changes: | modified (diff) |
---|
Also, I think we should add
name
to the dictionary returned bytrac.util.get_pkginfo
, so that a plugin implementation ofget_systeminfo
can follow the pattern:The change only needs to be made on 1.2dev though.
How about using
get_pkginfo
everywhere rather than relying on attributes that aren't consistent among packages and could be changed by the package author? For example, forPillow
I could only see to use:However,
get_pkginfo(PIL)['version']
seems much simpler.get_pkginfo(PIL).get('version', '')
might be even safer.Related: I'm still unsure of the complexity of the
trac_version
method that was created by extracting code in [14354/trunk/trac/env.py]. Under which conditions wouldget_pkginfo(core).get('version')
returnNone
for the Trac package?