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

dir2pi normalization broken for some wheel packages #76

Closed
dhagrow opened this issue May 8, 2018 · 3 comments · Fixed by #85
Closed

dir2pi normalization broken for some wheel packages #76

dhagrow opened this issue May 8, 2018 · 3 comments · Fixed by #85

Comments

@dhagrow
Copy link

dhagrow commented May 8, 2018

I'm looking specifically at the wheel for python-dateutil. I did the following:

$ pip2tgz pkgs/ python-dateutil

I then tried dir2pi with all the different normalization options (-n, -N, -a). pip installing from this index does not work in any case:

$ pip install --index-url file:///<blah>/pkgs/simple/ python-dateutil -v
...
Looking in indexes: file:///<blah>/pkgs/simple/
Collecting python-dateutil
  1 location(s) to search for versions of python-dateutil:
  * file:///<blah>/pkgs/simple/python-dateutil/
  Getting page file:///<blah>/pkgs/simple/python-dateutil/
   file: URL is directory, getting file:///<blah>/pkgs/simple/python-dateutil/index.html
  Analyzing links from page file:///<blah>/pkgs/simple/python-dateutil/index.html
    Skipping link file:///<blah>/pkgs/simple/python-dateutil/python-dateutil-2.7.2-py2.py3-none-any.whl (from file:///<blah>/pkgs/simple/python-dateutil/index.html); wrong project name (not python-dateutil)

However, if I manually rename the package name in simple/python-dateutil to use an underscore: python_dateutil-2.7.2-py2.py3-none-any.whl, and edit index.html to point to it, everything works:

$ pip install --index-url file:///<blah>/pkgs/simple/ python-dateutil -v
...
  Analyzing links from page file:///<blah>/pkgs/simple/python-dateutil/index.html
    Found link file:///<blah>/pkgs/simple/python-dateutil/python_dateutil-2.7.2-py2.py3-none-any.whl (from file:///<blah>/pkgs/simple/python-dateutil/index.html), version: 2.7.2

The problem seems to be with the way Wheel parses the filenames.

@leducvin
Copy link

leducvin commented May 11, 2018

I can confirm everything above. In my case I created a package with package name yaml_cfg.

Here is what is generated in /path/packages/wheels/simple/yaml-cfg/ (using dir2pi):

.
├── index.html
└── yaml-cfg-0.1.2-py2.py3-none-any.whl -> ../../yaml_cfg-0.1.2-py2.py3-none-any.whl

Note yaml-cfg-0.1.2-py2.py3-none-any.whl is a symlink pointing to /path/packages/wheels/yaml_cfg-0.1.2-py2.py3-none-any.whl.

Here is the content of index.html:

<a href='yaml-cfg-0.1.2-py2.py3-none-any.whl'>yaml-cfg-0.1.2-py2.py3-none-any.whl</a><br />

and here is the error upon invoking pip install yaml-cfg or pip install yaml_cfg:

Getting page file:///path/packages/wheels/simple/yaml-cfg/
   file: URL is directory, getting file:///path/packages/wheels/simple/yaml-cfg/index.html
  Analyzing links from page file:///path/packages/wheels/simple/yaml-cfg/index.html
    Skipping link file:///path/packages/wheels/simple/yaml-cfg/yaml-cfg-0.1.2-py2.py3-none-any.whl (from file:///path/packages/wheels/simple/yaml-cfg/index.html); wrong project name (not yaml-cfg)

If I modify index.html as such:

<a href='yaml_cfg-0.1.2-py2.py3-none-any.whl'>yaml-cfg-0.1.2-py2.py3-none-any.whl</a><br />

and do mv /path/packages/wheels/simple/yaml-cfg/yaml-cfg-0.1.2-py2.py3-none-any.whl /path/packages/wheels/simple/yaml-cfg/yaml_cfg-0.1.2-py2.py3-none-any.whl, then I can install using pip.

It seems crucial for pip that the name used in the link located in index.html be the same as the package name.

@dhagrow
Copy link
Author

dhagrow commented May 15, 2018

I hadn't noticed before, but it appears there's been a pull request (#67) for some time now that fixes this issue.

@safiyat
Copy link
Collaborator

safiyat commented Jul 15, 2019

Closed in #85.

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

Successfully merging a pull request may close this issue.

3 participants