Skip to content

Commit

Permalink
Automatically generate required pre-requisites (#2858)
Browse files Browse the repository at this point in the history
`get_required_prerequisites()` maintains a list of Prerequisites required by each platform.

But that same information is already stored in each Prerequisite class.

Rather than rather than maintaining two lists which might become inconsistent, auto-generate one.
  • Loading branch information
Julian-O authored Jul 22, 2023
1 parent 08b58fd commit f824d0e
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions pythonforandroid/prerequisites.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,22 +370,19 @@ def darwin_installer(self):


def get_required_prerequisites(platform="linux"):
DEFAULT_PREREQUISITES = dict(
darwin=[
HomebrewPrerequisite(),
AutoconfPrerequisite(),
AutomakePrerequisite(),
LibtoolPrerequisite(),
PkgConfigPrerequisite(),
CmakePrerequisite(),
OpenSSLPrerequisite(),
JDKPrerequisite(),
],
linux=[],
all_platforms=[],
)

return DEFAULT_PREREQUISITES["all_platforms"] + DEFAULT_PREREQUISITES[platform]
return [
prerequisite_cls()
for prerequisite_cls in [
HomebrewPrerequisite,
AutoconfPrerequisite,
AutomakePrerequisite,
LibtoolPrerequisite,
PkgConfigPrerequisite,
CmakePrerequisite,
OpenSSLPrerequisite,
JDKPrerequisite,
] if prerequisite_cls.mandatory.get(platform, False)
]


def check_and_install_default_prerequisites():
Expand Down

0 comments on commit f824d0e

Please sign in to comment.