in aws_lambda_builders/workflows/python_pip/workflow.py [0:0]
def __init__(self, source_dir, artifacts_dir, scratch_dir, manifest_path, runtime=None, osutils=None, **kwargs):
super(PythonPipWorkflow, self).__init__(
source_dir, artifacts_dir, scratch_dir, manifest_path, runtime=runtime, **kwargs
)
if osutils is None:
osutils = OSUtils()
if not self.download_dependencies and not self.dependencies_dir:
LOG.info(
"download_dependencies is False and dependencies_dir is None. Copying the source files into the "
"artifacts directory. "
)
self.actions = []
if not osutils.file_exists(manifest_path):
LOG.warning("requirements.txt file not found. Continuing the build without dependencies.")
self.actions.append(CopySourceAction(source_dir, artifacts_dir, excludes=self.EXCLUDED_FILES))
return
# If a requirements.txt exists, run pip builder before copy action.
if self.download_dependencies:
if self.dependencies_dir:
# clean up the dependencies folder before installing
self.actions.append(CleanUpAction(self.dependencies_dir))
self.actions.append(
PythonPipBuildAction(
artifacts_dir,
scratch_dir,
manifest_path,
runtime,
self.dependencies_dir,
binaries=self.binaries,
architecture=self.architecture,
)
)
# if dependencies folder is provided, copy dependencies from dependencies folder to build folder
# if combine_dependencies is false, will not copy the dependencies from dependencies folder to artifact
# folder
if self.dependencies_dir and self.combine_dependencies:
# when copying downloaded dependencies back to artifacts folder, don't exclude anything
# symlinking python dependencies is disabled for now since it is breaking sam local commands
if False and is_experimental_build_improvements_enabled(self.experimental_flags):
self.actions.append(LinkSourceAction(self.dependencies_dir, artifacts_dir))
else:
self.actions.append(CopySourceAction(self.dependencies_dir, artifacts_dir))
self.actions.append(CopySourceAction(source_dir, artifacts_dir, excludes=self.EXCLUDED_FILES))