Commit 294ebdaf authored by Leonardo Rochael Almeida's avatar Leonardo Rochael Almeida Committed by Jim Fulton

Always unpack what `wheel_to_egg()` generates (#373)

The `unpack_wheel` was blindly trusting the result of `wheel_to_egg()`
and possibly laying zipped eggs in `eggs-directory`.

Fix it to always unpack the result of `wheel_to_egg()` instead.
parent 61a97ec2
...@@ -1621,21 +1621,26 @@ def unpack_egg(location, dest): ...@@ -1621,21 +1621,26 @@ def unpack_egg(location, dest):
WHEEL_TO_EGG_WARNING = """ WHEEL_TO_EGG_WARNING = """
Using unpack_wheel() shim over deprecated wheel_to_egg(). Using unpack_wheel() shim over the deprecated wheel_to_egg() hook.
Please update your wheel extension implementation for one that installs a .whl Please update your wheel extension implementation for one that installs a .whl
handler in %s.UNPACKERS handler in %s.UNPACKERS
""".strip() % (__name__,) """.strip() % (__name__,)
def unpack_wheel(location, dest): def unpack_wheel(location, dest):
logger.warning(WHEEL_TO_EGG_WARNING)
# Deprecated backward compatibility shim. Please do not use. # Deprecated backward compatibility shim. Please do not use.
logger.warning(WHEEL_TO_EGG_WARNING)
basename = os.path.basename(location) basename = os.path.basename(location)
dists = setuptools.package_index.distros_for_location(location, basename) dists = setuptools.package_index.distros_for_location(location, basename)
wheel_to_egg(list(dists)[0], dest) # `wheel_to_egg()` might generate zipped eggs, so we have to make sure we
# get unpacked eggs in the end:
tmp_dest = tempfile.mkdtemp(dir=dest)
wheel_to_egg(list(dists)[0], tmp_dest)
[egg] = glob.glob(os.path.join(tmp_dest, '*.egg'))
unpack_egg(egg, dest)
shutil.rmtree(tmp_dest)
UNPACKERS = { UNPACKERS = {
# Buildout 2 no longer installs zipped eggs, so we always want to unpack it.
'.egg': unpack_egg, '.egg': unpack_egg,
'.whl': unpack_wheel, '.whl': unpack_wheel,
} }
......
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