def guard_from_parts(parts):
    """Combine parts of the path into a guard macro name."""
    name = parts[-1]

    # Remove .in suffix from config files
    if name.endswith(".in"):
        name = name[:-3]

    parts[-1] = name.replace(".", "_")
    return "_".join(part.upper() for part in parts)