Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WHEEL_INFO_RE regression in wheel==0.31.0 #235

Closed
derekbekoe opened this issue Apr 20, 2018 · 5 comments
Closed

WHEEL_INFO_RE regression in wheel==0.31.0 #235

derekbekoe opened this issue Apr 20, 2018 · 5 comments
Labels

Comments

@derekbekoe
Copy link

In wheel==0.30.0:

>>> from wheel.install import WHEEL_INFO_RE
>>> WHEEL_INFO_RE('helloworld-0.0.5.dist-info')
<_sre.SRE_Match object at 0x110107c90>
>>> WHEEL_INFO_RE('helloworld-0.0.5.dist-info').groupdict()
{'ver': '0.0.5', 'name': 'helloworld', 'abi': None, 'plat': None, 'pyver': None, 'build': None, 'namever': 'helloworld-0.0.5'}
>>> 

In wheel==0.31.0:

>>> from wheel.install import WHEEL_INFO_RE
>>> WHEEL_INFO_RE('helloworld-0.0.5.dist-info')
>>> WHEEL_INFO_RE('helloworld-0.0.5.dist-info').groupdict()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'groupdict'
@derekbekoe
Copy link
Author

It seems due to 88c480e

@agronholm
Copy link
Contributor

Looks like a duplicate of #234.

@agronholm
Copy link
Contributor

agronholm commented Apr 22, 2018

I'm a bit confused here. Although the regex might've matched a .dist-info path at some point, the only place this is used is in code which anyway rejects paths not ending in .whl. So what is the practical situation where this came up?

@derekbekoe
Copy link
Author

Hi @agronholm
We use it in our application to get some data inside the correct .dist-info for the package. Since there could be multiple .dist-infos for each package, we use WHEEL_INFO_RE to get the correct .dist-info.

E.g.:

from wheel.install import WHEEL_INFO_RE
dist_info_dirs = [f for f in os.listdir(dir) if f.endswith('.dist-info')]
for dist_info_dirname in dist_info_dirs:
    parsed_dist_info_dir = WHEEL_INFO_RE(dist_info_dirname)
    if parsed_dist_info_dir and parsed_dist_info_dir.groupdict().get('name') == PACKAGE_NAME:
        ... (get some information from the correct .dist-info)

Previously, parsed_dist_info_dir.groupdict().get('name') would work but now it does not.

Aside from the specifics of our use though, I guess the question is, is WHEEL_INFO_RE considered public because WHEEL_INFO_RE does allow parsing of .dist-info - https://github.com/pypa/wheel/blob/master/wheel/install.py#L36

@agronholm
Copy link
Contributor

As wheel does not have a public API, the developers are not responsible for any breakage caused by internal refactoring. I suggest that you copy the regex to your own app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants