示例#1
0
    def _get_lambda_function_code_paths(context, function_name, source_directory_paths, function_runtime):
        '''Gets the path to the lambda code directory and paths all to the directories identified
        by the .import file found in the lambda code directory.

        The lambda code directory is determined using get_lambda_function_code_path.

        Arguments:

            context: a Context object.

            source_directory_paths: a list of paths to the directories to search.

            function_name: the name of the lambda function resource.

        Returns three values:

           code_path: the value returned by get_lambda_function_code_path.
           imported_paths: a list containing paths imported by code_path.
           multi_imports: a dictionary of import names to the set of gem names that will participate in the import.
                          The multi-imports come from .import files containing *.ImportName entries.
        '''
        code_path = Uploader._get_lambda_function_code_path(context, function_name, source_directory_paths, function_runtime)

        imported_paths = []
        multi_imports = [] 
        if function_runtime.startswith('python'):
            imported_paths, multi_imports = common_code.resolve_imports(context, code_path)

        return code_path, imported_paths, multi_imports
示例#2
0
 def __add_plugin_paths(self):
     added_paths = [self.__module_directory, self.__module_lib_directory]
     imported_paths, multi_imports = common_code.resolve_imports(
         self.context, self.__module_directory)
     added_paths.extend(imported_paths)
     sys.path.extend(added_paths)
     return added_paths, multi_imports
示例#3
0
    def _get_lambda_function_code_paths(context, function_name, source_directory_paths):
        '''Gets the path to the lambda code directory and paths all to the directories identified 
        by the .import file found in the lambda code directory.

        The lambda code directory is determined using get_lambda_function_code_path.

        Arguments:

            context: a Context object.

            source_directory_paths: a list of paths to the directories to search.

            function_name: the name of the lambda function resource.

        Returns two values:

           code_path: the value returned by get_lambda_function_code_path.
           imported_paths: a list containing paths imported by code_path.
        '''
        code_path = Uploader._get_lambda_function_code_path(context, function_name, source_directory_paths)

        imported_paths = common_code.resolve_imports(context, code_path)

        # TODO: The use of shared-lambda-code was deprecated in Lumberyard 1.10.
        for source_directory_path in source_directory_paths:
            shared_lambda_code_path = os.path.join(source_directory_path, 'shared-lambda-code')
            if os.path.isdir(shared_lambda_code_path):
                context.view.using_deprecated_lambda_code_path(function_name, shared_lambda_code_path, os.path.join(source_directory_path, 'common-code', 'LambdaCommon'))
                imported_paths.add(shared_lambda_code_path)
        # End deprecated code

        return code_path, imported_paths