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

PermissionError attempting to install coverage on Windows #64

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

PermissionError attempting to install coverage on Windows #64

cjw296 opened this issue Feb 13, 2013 · 3 comments

Comments

@cjw296
Copy link
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
Copy link
Contributor Author

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
Copy link
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
Copy link
Contributor

reinout commented Feb 13, 2013

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

jimfulton pushed a commit that referenced this issue Feb 14, 2013
Fix for #64: __pycache__ dir inside distutils scripts metadata directory
jperkin pushed a commit to TritonDataCenter/pkgsrc-legacy that referenced this issue Dec 9, 2013
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 TritonDataCenter/pkgsrc-legacy that referenced this issue Mar 14, 2014
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
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants