Skip to content

Commit

Permalink
Allow blacklisting wheels
Browse files Browse the repository at this point in the history
Some wheels are not installable by the wheel package, only by pip,
and break buildout.

See:

pexpect/ptyprocess#31 (comment)
  • Loading branch information
leorochael committed May 28, 2017
1 parent aa7a031 commit a3a7542
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/buildout/wheel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
orig_distros_for_location = setuptools.package_index.distros_for_location


WHEEL_BLACKLIST = set()


def unpack_wheel(spec, dest):
WheelInstaller(spec).install_into(dest)

Expand Down Expand Up @@ -126,6 +129,9 @@ def distros_for_location(location, basename, metadata=None):
Here we override setuptools to give wheels a chance.
"""
if basename.endswith('.whl'):
if basename in WHEEL_BLACKLIST:
logger.warn("ignoring blacklisted wheel: %s", basename)
return ()
wi = WheelInstaller(basename)
if wi.compatible:
# It's a match. Treat it as a binary
Expand All @@ -137,10 +143,15 @@ def distros_for_location(location, basename, metadata=None):


def load(buildout):
WHEEL_BLACKLIST.update(set(
buildout['buildout'].get('wheel-blacklist', '').splitlines()
))
setuptools.package_index.distros_for_location = distros_for_location
buildout.old_unpack_wheel = zc.buildout.easy_install.UNPACKERS.get('.whl')
zc.buildout.easy_install.UNPACKERS['.whl'] = unpack_wheel
logger.debug('Patched in wheel support')
logger.debug("Blacklisting wheels:\n%s",
"\n".join(sorted(WHEEL_BLACKLIST)))


def unload(buildout):
Expand Down

0 comments on commit a3a7542

Please sign in to comment.