Commit 3bf9b96c authored by Jim Fulton's avatar Jim Fulton

Merge pull request #67 from reinout/reinout-33-cornercase

Fix for #64: __pycache__ dir inside distutils scripts metadata directory
parents a31ae812 7c397c53
Change History
**************
Next version
============
- Fix for distutils scripts installation on Python 3, related to
``__pycache__`` directories.
2.0.0 (2013-02-10)
==================
......
......@@ -915,6 +915,9 @@ 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('scripts/' + name):
# Probably Python 3 __pycache__ directory.
continue
contents = dist.get_metadata('scripts/' + name)
distutils_scripts.append((name, contents))
else:
......
......@@ -957,6 +957,20 @@ contain a source encoding hint; buildout retains it.
Due to the nature of distutils scripts, buildout cannot pass arguments as
there's no specific method to pass them to.
In some cases, a python 3 ``__pycache__`` directory can end up in an internal
``EGG-INFO`` metadata directory, next to the script information we're looking
for. Buildout doesn't crash on that:
>>> eggname = [name for name in os.listdir(distdir2)
... if name.endswith('egg')][0]
>>> scripts_metadata_dir = os.path.join(
... distdir2, eggname, 'EGG-INFO', 'scripts')
>>> os.mkdir(os.path.join(scripts_metadata_dir, '__dummy__'))
>>> scripts = zc.buildout.easy_install.scripts(
... ['du_zipped'], ws, sys.executable, distbin2)
>>> ls(distbin2)
- distutilsscript
Handling custom build options for extensions provided in source distributions
-----------------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment