| 1 |
from importlib.metadata import entry_points |
| 2 |
|
| 3 |
|
| 4 |
def get_platforms(): |
| 5 |
return { |
| 6 |
entry_point.name: entry_point.load() |
| 7 |
for entry_point in entry_points(group="briefcase.platforms") |
| 8 |
} |
| 9 |
|
| 10 |
|
| 11 |
def get_output_formats(platform): |
| 12 |
# The values for output format entry points are the importable module names, |
| 13 |
# which may not match the human-readable name. (e.g., the Xcode format is in |
| 14 |
# the briefcase.platforms.macOS.xcode module). The human-readable names for |
| 15 |
# formats must be extracted from the `output_format` attribute of a command |
| 16 |
# *in* the module; every output format has a `create` command, so we use |
| 17 |
# that. |
| 18 |
output_formats = {} |
| 19 |
for entry_point in entry_points(group=f"briefcase.formats.{platform}"): |
| 20 |
module = entry_point.load() |
| 21 |
output_formats[module.create.output_format] = module |
| 22 |
|
| 23 |
return output_formats |