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

PermissionError attempting to install coverage on Windows #64

Closed
cjw296 opened this Issue Feb 13, 2013 · 3 comments

Comments

Projects
None yet
3 participants
@cjw296
Contributor

cjw296 commented Feb 13, 2013

An internal error occured due to a bug in either zc.buildout or in a
recipe being used:

Traceback (most recent call last):
  File "c:\users\jenkins\.buildout\eggs\zc.buildout-2.0.0-py3.3.egg\zc\buildout\buildout.py", line 1808, in main
    getattr(buildout, command)(args)
  File "c:\users\jenkins\.buildout\eggs\zc.buildout-2.0.0-py3.3.egg\zc\buildout\buildout.py", line 606, in install
    installed_files = self[part]._call(recipe.install)
  File "c:\users\jenkins\.buildout\eggs\zc.buildout-2.0.0-py3.3.egg\zc\buildout\buildout.py", line 1333, in _call
    return f()
  File "c:\users\jenkins\.buildout\eggs\zc.recipe.egg-2.0.0a3-py3.3.egg\zc\recipe\egg\egg.py", line 162, in install
    relative_paths=self._relative_paths,
  File "c:\users\jenkins\.buildout\eggs\zc.buildout-2.0.0-py3.3.egg\zc\buildout\easy_install.py", line 916, in scripts
    contents = dist.get_metadata('scripts/' + name)
  File "c:\users\jenkins\.buildout\eggs\distribute-0.6.34-py3.3.egg\pkg_resources.py", line 1217, in get_metadata
    return self._get(self._fn(self.egg_info,name)).decode("utf-8")
  File "c:\users\jenkins\.buildout\eggs\distribute-0.6.34-py3.3.egg\pkg_resources.py", line 1327, in _get
    stream = open(path, 'rb')
PermissionError: [Errno 13] Permission denied: 'c:\\users\\jenkins\\.buildout\\eggs\\coverage-3.6-py3.3-win32.egg\\EGG-INFO\\scripts\\__pycache__' 
@cjw296

This comment has been minimized.

Contributor

cjw296 commented Feb 13, 2013

@mgedmin suggests the following:

diff --git a/src/zc/buildout/easy_install.py b/src/zc/buildout/easy_install.py
index 1c81593..60fab6e 100644
--- a/src/zc/buildout/easy_install.py
+++ b/src/zc/buildout/easy_install.py
@@ -913,6 +913,8 @@ def scripts(reqs, working_set, executable, dest=None,
             # /EGG-INFO/scripts/.
             if dist.metadata_isdir('scripts'):
                 for name in dist.metadata_listdir('scripts'):
+                    if dist.metadata_isdir(name):
+                        continue
                     contents = dist.get_metadata('scripts/' + name)
                     distutils_scripts.append((name, contents))
         else:
@reinout

This comment has been minimized.

Contributor

reinout commented Feb 13, 2013

Yes, this could work (looking at the error message).

What bugs me though is that coverage doesn't have any "old-style distutils scripts", it uses console_script entrypoints. So why is there an EGG-INFO/scripts directory? The check for that scripts/ directory in the EGG-INFO dir was suggested to me a couple of years ago as the most sure-fire way to find distutils scripts.

I tried it locally (not on windows) and the scripts directory doesn't exist when I setup.py install coverage in a virtualenv. Is this special to windows? Combined with python 3.3's __pycache__ stuff?

Could you take a look to see if there's something else in that scripts dir apart from __pycache__?

reinout added a commit to reinout/buildout that referenced this issue Feb 13, 2013

Added test demonstrating issue buildout#64
A directory hacked inside the distutils `EGG-INFO/scripts` metadata directory
(which can apparently happen in python 3.3 with a `__pycache__` directory)
breaks the current distutils script detection code.

Refs buildout#64
@reinout

This comment has been minimized.

Contributor

reinout commented Feb 13, 2013

I've got a pull request open that fixes this: #67

@jimfulton jimfulton closed this in 3c13e2f Feb 14, 2013

jimfulton added a commit that referenced this issue Feb 14, 2013

Merge pull request #67 from reinout/reinout-33-cornercase
Fix for #64: __pycache__ dir inside distutils scripts metadata directory

jperkin pushed a commit to joyent/pkgsrc-legacy that referenced this issue Dec 9, 2013

wiz
Update to 0.6.36.
0.6.36
------

* Pull Request #35: In `Buildout issue 64
  <https://github.com/buildout/buildout/issues/64>`_, it was reported that
  under Python 3, installation of distutils scripts could attempt to copy
  the ``__pycache__`` directory as a file, causing an error, apparently only
  under Windows. Easy_install now skips all directories when processing
  metadata scripts.

jperkin pushed a commit to joyent/pkgsrc-legacy that referenced this issue Mar 14, 2014

wiz
Update to 0.6.36.
0.6.36
------

* Pull Request #35: In `Buildout issue 64
  <https://github.com/buildout/buildout/issues/64>`_, it was reported that
  under Python 3, installation of distutils scripts could attempt to copy
  the ``__pycache__`` directory as a file, causing an error, apparently only
  under Windows. Easy_install now skips all directories when processing
  metadata scripts.

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Oct 11, 2014

wiz
Update to 0.6.36.
0.6.36
------

* Pull Request #35: In `Buildout issue 64
  <https://github.com/buildout/buildout/issues/64>`_, it was reported that
  under Python 3, installation of distutils scripts could attempt to copy
  the ``__pycache__`` directory as a file, causing an error, apparently only
  under Windows. Easy_install now skips all directories when processing
  metadata scripts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment