in chalice/deploy/packager.py [0:0]
def _install_purelib_and_platlib(self, wheel: Package, root: str) -> None:
# Take a wheel package and the directory it was just unpacked into and
# unpackage the purelib/platlib directories if they are present into
# the parent directory. On some systems purelib and platlib need to
# be installed into separate locations, for lambda this is not the case
# and both should be installed in site-packages.
dirnames = self._osutils.get_directory_contents(root)
for dirname in dirnames:
if wheel.matches_data_dir(dirname):
data_dir = self._osutils.joinpath(root, dirname)
break
else:
return
unpack_dirs = {'purelib', 'platlib'}
data_contents = self._osutils.get_directory_contents(data_dir)
for content_name in data_contents:
if content_name in unpack_dirs:
source = self._osutils.joinpath(data_dir, content_name)
self._osutils.copytree(source, root)
# No reason to keep the purelib/platlib source directory around
# so we delete it to conserve space in the package.
self._osutils.rmtree(source)