buildout / buildout.wheel

Buildout extension to provide wheel support
MIT License
7 stars 8 forks source link

Cannot install wheel from local file system if name not all lowercase on Windows #11

Open daybarr opened 7 years ago

daybarr commented 7 years ago

Using buildout.wheel 0.2.0 with zc.buildout 2.9.3, github bash on Windows 10.

Steps to reproduce follow.

First Prepare a buildout.cfg in empty directory, bootstrap buildout into a new virtualenv, download the Django wheel to local directory.

day.barr@win10-laptop MINGW64 ~/dev/buildout.wheel.test
$ ls -l
total 1
-rw-r--r-- 1 day.barr 1049089 139 Apr 23 21:16 buildout.cfg

day.barr@win10-laptop MINGW64 ~/dev/buildout.wheel.test
$ cat buildout.cfg
[buildout]
extensions = buildout.wheel
parts = django

[django]
recipe = zc.recipe.egg
eggs = Django==1.11
index =
find-links = .
day.barr@win10-laptop MINGW64 ~/dev/buildout.wheel.test

$ mkvirtualenv buildout.wheel.test
New python executable in C:\Users\day.barr\.virtualenvs\buildout.wheel.test\Scripts\python.exe
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating C:\Users\day.barr\.virtualenvs\buildout.wheel.test\Scripts\predeactivate
virtualenvwrapper.user_scripts creating C:\Users\day.barr\.virtualenvs\buildout.wheel.test\Scripts\postdeactivate
virtualenvwrapper.user_scripts creating C:\Users\day.barr\.virtualenvs\buildout.wheel.test\Scripts\preactivate
virtualenvwrapper.user_scripts creating C:\Users\day.barr\.virtualenvs\buildout.wheel.test\Scripts\postactivate
virtualenvwrapper.user_scripts creating C:\Users\day.barr\.virtualenvs\buildout.wheel.test\Scripts\get_env_details
virtualenvwrapper.user_scripts could not run "C:\Users\day.barr\.virtualenvs\premkvirtualenv": [Error 2] The system cannot find the file specified
virtualenvwrapper.user_scripts could not run "C:\Users\day.barr\.virtualenvs\preactivate": [Error 2] The system cannot find the file specified
virtualenvwrapper.user_scripts could not run "C:\Users\day.barr\.virtualenvs\buildout.wheel.test\Scripts\preactivate": [Error 2] The system cannot find the file specified
(buildout.wheel.test)
day.barr@win10-laptop MINGW64 ~/dev/buildout.wheel.test
$ curl -O 'https://raw.githubusercontent.com/buildout/buildout/2.9.3/bootstrap/bootstrap.py'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  7467  100  7467    0     0  17047      0 --:--:-- --:--:-- --:--:-- 17694
(buildout.wheel.test)
day.barr@win10-laptop MINGW64 ~/dev/buildout.wheel.test
$ python bootstrap.py
ez_setup.py is deprecated and when using it setuptools will be pinned to 33.1.1 since it's the last version that supports setuptools self upgrade/installation, check https://github.com/pypa/setuptools/issues/581 for more info; use pip to install setuptools
Downloading https://pypi.io/packages/source/s/setuptools/setuptools-33.1.1.zip
Extracting in c:\users\day~1.bar\appdata\local\temp\tmpuagfwz
Now working in c:\users\day~1.bar\appdata\local\temp\tmpuagfwz\setuptools-33.1.1
Building a Setuptools egg in c:\users\day~1.bar\appdata\local\temp\bootstrap-d93yfz
warning: no files found matching '*' under directory 'setuptools\_vendor'
c:\users\day~1.bar\appdata\local\temp\bootstrap-d93yfz\setuptools-33.1.1-py2.7.egg
no previously-included directories found matching 'doc'
no previously-included directories found matching 'old-tutorial'
Creating directory 'C:\\Users\\day.barr\\dev\\buildout.wheel.test\\bin'.
Creating directory 'C:\\Users\\day.barr\\dev\\buildout.wheel.test\\parts'.
Creating directory 'C:\\Users\\day.barr\\dev\\buildout.wheel.test\\develop-eggs'.
Generated script 'C:\\Users\\day.barr\\dev\\buildout.wheel.test\\bin\\buildout'.
(buildout.wheel.test)
day.barr@win10-laptop MINGW64 ~/dev/buildout.wheel.test
$ pip download --only-binary :all: Django==1.11
Collecting Django==1.11
  Downloading Django-1.11-py2.py3-none-any.whl (6.9MB)
    100% |################################| 6.9MB 2.3MB/s
  Saved c:\users\day.barr\dev\buildout.wheel.test\django-1.11-py2.py3-none-any.whl
Collecting pytz (from Django==1.11)
  Downloading pytz-2017.2-py2.py3-none-any.whl (484kB)
    100% |################################| 491kB 1.6MB/s
  Saved c:\users\day.barr\dev\buildout.wheel.test\pytz-2017.2-py2.py3-none-any.whl
Successfully downloaded Django pytz
(buildout.wheel.test)
day.barr@win10-laptop MINGW64 ~/dev/buildout.wheel.test
$ ls -la
total 7293
drwxr-xr-x 1 day.barr 1049089       0 Apr 24 09:38 ./
drwxr-xr-x 1 day.barr 1049089       0 Apr 24 09:30 ../
-rw-r--r-- 1 day.barr 1049089 6942445 Apr 24 09:38 Django-1.11-py2.py3-none-any.whl
drwxr-xr-x 1 day.barr 1049089       0 Apr 24 09:33 bin/
-rw-r--r-- 1 day.barr 1049089    7467 Apr 24 09:33 bootstrap.py
-rw-r--r-- 1 day.barr 1049089     139 Apr 23 21:16 buildout.cfg
drwxr-xr-x 1 day.barr 1049089       0 Apr 24 09:33 develop-eggs/
drwxr-xr-x 1 day.barr 1049089       0 Apr 24 09:33 parts/
-rw-r--r-- 1 day.barr 1049089  484917 Apr 24 09:38 pytz-2017.2-py2.py3-none-any.whl

Now try to buildout install (-U to be sure I'm not using my user prefs (cache etc)):

(buildout.wheel.test)
day.barr@win10-laptop MINGW64 ~/dev/buildout.wheel.test
$ bin/buildout -U
Creating directory 'C:\\Users\\day.barr\\dev\\buildout.wheel.test\\eggs'.
Getting distribution for 'buildout.wheel'.
warning: no files found matching 'shootout.cfg'
Got buildout.wheel 0.2.0.
Getting distribution for 'six'.
no previously-included directories found matching 'documentation\_build'
zip_safe flag not set; analyzing archive contents...
six: module references __path__
Got six 1.10.0.
Getting distribution for 'zc.recipe.egg>=2.0.0a3'.
Got zc.recipe.egg 2.0.3.
Installing django.
Not found: /Django/
Not found: /Django/
Getting distribution for 'Django==1.11'.
While:
  Installing django.
  Getting distribution for 'Django==1.11'.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "c:\users\day.barr\.buildout\eggs\zc.buildout-2.9.3-py2.7.egg\zc\buildout\buildout.py", line 2123, in main
    getattr(buildout, command)(args)
  File "c:\users\day.barr\.buildout\eggs\zc.buildout-2.9.3-py2.7.egg\zc\buildout\buildout.py", line 796, in install
    installed_files = self[part]._call(recipe.install)
  File "c:\users\day.barr\.buildout\eggs\zc.buildout-2.9.3-py2.7.egg\zc\buildout\buildout.py", line 1553, in _call
    return f()
  File "c:\users\day.barr\dev\buildout.wheel.test\eggs\zc.recipe.egg-2.0.3-py2.7.egg\zc\recipe\egg\egg.py", line 126, in install
    reqs, ws = self.working_set()
  File "c:\users\day.barr\dev\buildout.wheel.test\eggs\zc.recipe.egg-2.0.3-py2.7.egg\zc\recipe\egg\egg.py", line 84, in working_set
    allow_hosts=self.allow_hosts)
  File "c:\users\day.barr\.buildout\eggs\zc.buildout-2.9.3-py2.7.egg\zc\buildout\easy_install.py", line 913, in install
    return installer.install(specs, working_set)
  File "c:\users\day.barr\.buildout\eggs\zc.buildout-2.9.3-py2.7.egg\zc\buildout\easy_install.py", line 665, in install
    for dist in self._get_dist(requirement, ws):
  File "c:\users\day.barr\.buildout\eggs\zc.buildout-2.9.3-py2.7.egg\zc\buildout\easy_install.py", line 563, in _get_dist
    dists = [_move_to_eggs_dir_and_compile(dist, self._dest)]
  File "c:\users\day.barr\.buildout\eggs\zc.buildout-2.9.3-py2.7.egg\zc\buildout\easy_install.py", line 1698, in _move_to_eggs_dir_and_compile
    unpacker(dist.location, tmp_dest)
  File "c:\users\day.barr\dev\buildout.wheel.test\eggs\buildout.wheel-0.2.0-py2.7.egg\buildout\wheel\__init__.py", line 25, in unpack_wheel
    WheelInstaller(spec).install_into(dest)
  File "c:\users\day.barr\dev\buildout.wheel.test\eggs\buildout.wheel-0.2.0-py2.7.egg\buildout\wheel\__init__.py", line 67, in install_into
    self.wheel.install(overrides=overrides)
  File "c:\users\day.barr\.virtualenvs\buildout.wheel.test\lib\site-packages\wheel\install.py", line 268, in install
    if self.parsed_wheel_info['Root-Is-Purelib'] == 'true':
  File "c:\users\day.barr\.virtualenvs\buildout.wheel.test\lib\site-packages\wheel\decorator.py", line 17, in __get__
    val = self.wrapped(inst)
  File "c:\users\day.barr\.virtualenvs\buildout.wheel.test\lib\site-packages\wheel\install.py", line 238, in parsed_wheel_info
    return read_pkg_info_bytes(self.zipfile.read(self.wheelinfo_name))
  File "c:\users\day.barr\.virtualenvs\buildout.wheel.test\lib\site-packages\wheel\decorator.py", line 17, in __get__
    val = self.wrapped(inst)
  File "c:\users\day.barr\.virtualenvs\buildout.wheel.test\lib\site-packages\wheel\install.py", line 232, in zipfile
    self.verify(vzf)
  File "c:\users\day.barr\.virtualenvs\buildout.wheel.test\lib\site-packages\wheel\install.py", line 385, in verify
    record = zipfile.read(record_name)
  File "c:\python27\Lib\zipfile.py", line 938, in read
    return self.open(name, "r", pwd).read()
  File "c:\users\day.barr\.virtualenvs\buildout.wheel.test\lib\site-packages\wheel\install.py", line 437, in open
    ef = zipfile.ZipFile.open(self, name_or_info, mode, pwd)
  File "c:\python27\Lib\zipfile.py", line 964, in open
    zinfo = self.getinfo(name)
  File "c:\python27\Lib\zipfile.py", line 912, in getinfo
    'There is no item named %r in the archive' % name)
KeyError: "There is no item named 'django-1.11.dist-info/RECORD' in the archive"

Note that the path in the .whl archive that we should be looking for is 'Django-1.11.dist-info/RECORD' (note uppercase D).

daybarr commented 7 years ago

Observe that this work ok when wheel is downloaded from an index server

(buildout.wheel.test)
day.barr@win10-laptop MINGW64 ~/dev/buildout.wheel.test
$ bin/buildout -U django:index=https://pypi.python.org/simple/
Installing django.
Getting distribution for 'Django==1.11'.
Got Django 1.11.
Getting distribution for 'pytz'.
Got pytz 2017.2.
Generated script 'C:\\Users\\day.barr\\dev\\buildout.wheel.test\\bin\\django-admin'.
Generated script 'C:\\Users\\day.barr\\dev\\buildout.wheel.test\\bin\\django-admin.py'.

It seems that we have to be installing directly from local file system (thanks to find_links = . in the buildout.cfg) to hit the bug.