INNER CODE UNIT · Python

generate_content_hash

terraform-aws-modules/terraform-aws-lambda · package.py:240

def generate_content_hash(source_paths, hash_func=hashlib.sha256, log=None):
    """
    Generate a content hash of the source paths.
    """

    if log:
        log = log.getChild("hash")
    _log = log if log.isEnabledFor(DEBUG3) else None

    hash_obj = hash_func()

    for source_path, pf, prefix in source_paths:
        if pf is not None:
            for path_from_pattern in pf.filter(source_path, prefix):
                if os.path.isdir(path_from_pattern):
                    # Hash only the path of the directory
                    source_dir = path_from_pattern
                    source_file = None

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…