| 103 | # installed, so it should be both unique between different products, and stable between |
| 104 | # different versions of a product. |
| 105 | def get_bundle_app_name(info, name): |
| 106 | # If reverse_domain_identifier is provided, use it as-is, |
| 107 | if (rdi := info.get("reverse_domain_identifier")) is not None: |
| 108 | if "." not in rdi: |
| 109 | raise ValueError(f"reverse_domain_identifier {rdi!r} contains no dots") |
| 110 | bundle, app_name = rdi.rsplit(".", 1) |
| 111 | |
| 112 | # Ensure that the last component is a valid Python package name, as Briefcase |
| 113 | # requires. |
| 114 | if not re.fullmatch( |
| 115 | r"[A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9]", app_name, flags=re.IGNORECASE |
| 116 | ): |
| 117 | app_name = make_app_name( |
| 118 | app_name, f"Last component of reverse_domain_identifier {rdi!r}" |
| 119 | ) |
| 120 | |
| 121 | # If reverse_domain_identifier isn't provided, generate it from the name. |
| 122 | else: |
| 123 | bundle = DEFAULT_REVERSE_DOMAIN_ID |
| 124 | app_name = make_app_name(name, f"Name {name!r}") |
| 125 | |
| 126 | return bundle, app_name |
| 127 | |
| 128 | |
| 129 | def txt_to_rtf(txt: str) -> str: |