Takes an arbitrary string with at least one alphanumeric character, and makes it into a valid Python package name.
(name, source)
| 92 | |
| 93 | |
| 94 | def make_app_name(name, source): |
| 95 | """Takes an arbitrary string with at least one alphanumeric character, and makes it into a valid Python package name.""" |
| 96 | app_name = re.sub(r"[^a-z0-9]+", "-", name.lower()).strip("-") |
| 97 | if not app_name: |
| 98 | raise ValueError(f"{source} contains no alphanumeric characters") |
| 99 | return app_name |
| 100 | |
| 101 | |
| 102 | # Some installer types use the reverse domain ID to detect when the product is already |
no outgoing calls
no test coverage detected