Vendoring: Drop the bin directory

It contains the executables: easy_install, distro, chardetect etc.

It should not be picked as vendored library.

Related to https://github.com/pypa/pip/issues/5347
This commit is contained in:
Miro Hrončok 2018-04-28 11:34:22 +02:00
parent 461d94698e
commit 04e98d9718
1 changed files with 6 additions and 2 deletions

View File

@ -17,8 +17,8 @@ FILE_WHITE_LIST = (
)
def drop_dir(path):
shutil.rmtree(str(path))
def drop_dir(path, **kwargs):
shutil.rmtree(str(path), **kwargs)
def remove_all(paths):
@ -114,6 +114,10 @@ def vendor(ctx, vendor_dir):
drop_dir(vendor_dir / 'pkg_resources' / '_vendor')
drop_dir(vendor_dir / 'pkg_resources' / 'extern')
# Drop the bin directory (contains easy_install, distro, chardetect etc.)
# Might not appear on all OSes, so ignoring errors
drop_dir(vendor_dir / 'bin', ignore_errors=True)
# Drop interpreter and OS specific msgpack libs.
# Pip will rely on the python-only fallback instead.
remove_all(vendor_dir.glob('msgpack/*.so'))