pkginfo picks random package if multiple package with the same prefix are installes

Bug #1974172 reported by Gerhard Schmidt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pkginfo
Confirmed
Undecided
Tres Seaver

Bug Description

I'm trying to use pkginfo to retrive infos about some installed Packages.

e.g. these packages are installed

pyramid 2.0
pyramid-chameleon 0.3
pyramid-debugtoolbar 4.9
pyramid-deform 0.2
pyramid-layout 1.0.1
pyramid-mailer 0.15.1.1
pyramid-mako 1.1.0
pyramid-mytum 0.17.5
pyramid-retry 2.1.1
pyramid-session-cookie 1.0.2
pyramid-tm 2.5
pyramid-utilities 0.9.2

when in try to get information about pyramid-chameleon everything works fine.

When in want some information about pyramid, pkg returns one of the other packages.

the problem is the read method. It builds a list of all entries matching pyramid*.egg-info and pyramid*.dist-info and pick the first one that exists.

I changed the lines 34-35 to
            egg_pattern = '%s-*.egg-info' % package
            dist_pattern = '%s-*.dist-info' % package

fixes the problem for me. I don't think this is the best solution.

Regards
  Estartu

Tres Seaver (tseaver)
Changed in pkginfo:
status: New → Confirmed
assignee: nobody → Tres Seaver (tseaver)
Revision history for this message
Tres Seaver (tseaver) wrote :

Thanks very much for the report!

I'm curious why you think your fix is not ideal. It looks to me as though any installed '.egg-info' or '.dist-info' directory *should* be prefixed by '<package_name>-'.

Revision history for this message
Gerhard Schmidt (estartu71) wrote : Re: [Bug 1974172] Re: pkginfo picks random package if multiple package with the same prefix are installes

I wasn't sure if _ and - are consistently exchanged. As you see in the
list the the package name are with - while the directory on the disks
are with _. So there might be packages that have a - in the directory
name which will break my fix again.

The version string is quite fixed in it's format. So it might be
possible to define a regular expression for the version information and
matching against <projectname>-<versionexpression>.{egg|dist)-info.
This whould be the premium solution. But I hadn't had the time to look
into it.

Am 19.05.22 um 18:31 schrieb Tres Seaver:
> Thanks very much for the report!
>
> I'm curious why you think your fix is not ideal. It looks to me as
> though any installed '.egg-info' or '.dist-info' directory *should* be
> prefixed by '<package_name>-'.
>

Revision history for this message
Gerhard Schmidt (estartu71) wrote :

the problem is still in 1.8.3

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers