def _install_dist_package(self):
# Get the name of the package that we just built
package_name = self.distribution.get_name()
# Get the dist directory that bdist_wheel put the package in
# Create the lambda build dir
self._lambda_build_dir = os.path.join('build', 'ldist-'+package_name)
try:
if os.path.exists(self._lambda_build_dir):
shutil.rmtree(self._lambda_build_dir)
log.info('creating {}'.format(self._lambda_build_dir))
os.makedirs(self._lambda_build_dir)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(self._lambda_build_dir):
pass
else:
raise DistutilsInternalError('{} already exists and is not a directory'.format(self._lambda_build_dir))
log.info('installing package {} from {} into {}'.format(package_name,
self._dist_dir,
self._lambda_build_dir))
pip = Popen(['pip', 'install',
'-f', self._dist_dir,
'-t', self._lambda_build_dir, package_name],
stdout=PIPE, stderr=PIPE)
stdout, stderr = pip.communicate()
log.debug("pip stdout: {}".format(stdout))
log.debug("pip stderr: {}".format(stderr))
if pip.returncode is not 0:
raise DistutilsPlatformError('pip returned unsuccessfully')
评论列表
文章目录