PyYAML/yaml mismatch fools pkginfo

Bug #1829824 reported by Paul D.Smith
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pkginfo
Opinion
Undecided
Unassigned

Bug Description

The PyYAML distribution has a name mismatch between the package installed e.g. with pip, which is 'PyYAML' and the package that is imported by Python code, which is 'yaml'. This means that pkginfo is unable to map from 'yaml' to the package information for PyYAML.
One possible workaround has been suggested by the pkginfo authors:
"But because PyYAML breaks the convention of naming the distribution after the importable module, pkginfo can't "dead reckon" back from the imported module to find the distribution metadata. So, to rephrase what you asked for earlier, I could extend the 'Installed' class to take an optional "distribution_name" argument, and use it instead of the imported package's name when looking for the 'PKG-INFO' / 'EGG-INFO' files."
Is it possible to approach this in a more 'sledgehammer' manner by doing something like this?
1. Try using the anticipated name ('yaml')
2. If not found, scan ALL possible PKG-INFO/EGG-INFO files; would one of them reference yaml? If so, then throw a warning to the user (that could be turned off/ignored in the usual Python-ish manners) but then carry on and produce the info for 'yaml' based on the found 'PyYAML' info?
3. Might want to ensure that there is only one file references 'yaml'; can't imagine there would be more but who knows!
And of course this might occur for other packages in similar bad ways :-(.

Revision history for this message
Tres Seaver (tseaver) wrote :

No, we couldn't do what you ask: namespace packages have precisely the characteristic you couldn't imagine (multiple installed distributions each containing the same top-level package name).

Changed in pkginfo:
status: New → Opinion
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.