Skip to content

Convert dependencies into class instances #2

Description

@weasdown

Background

Currently in [feb25-fix]/configure.py, downloading and installing of each dependency is handled as a bunch of functions. Given that each dependency needs to be downloaded then installed - in other words we have a consistent workflow across dependencies - we can create a class representation of this instead.

Definition of done

  • Make a Command class that represents a command that can be run. Use a structure similar to Flutter's example Command class. This can also use a Result instance to define the result of running the Command.
  • Make a [Dependency] class with the following members:
    • attribute name: str: the dependency's name, e.g. 'wxWidgets'.
    • attribute version: str: the version number of the dependency to be installed. Must follow semantic versioning, e.g. '3.2.6'.
    • attribute download_url: str: the URL to download the dependency's source code from.
    • attribute test_item: str: a relative path from the dependency's folder in depends (e.g. depends/wxWidgets) to a file or directory whose existence shows that the dependency has already been fully downloaded and installed.
    • attribute download: Command: downloads the dependency to the depends folder.
    • attribute install: Command: installs the dependency within the correct folder within depends.
    • Others TBC...

Desired Usage

This will enable dependencies to be defined and installed with simple, consistent commmands, e.g.:

# Define wxWidgets dependency.
wx_version: str = '3.2.6'  # Use semantic versioning.
wxWidgets: Dependency = Dependency(name='wxWidgets', version='3.2.6', url=f'https://github.com/wxWidgets/wxWidgets/releases/download/v{wx_version}/wxWidgets-{wx_version}.tar.bz2', test_item=f'wxWidgets-{wx_version}')

wxWidgets.download()  # Download wxWidgets.
wxWidgets.install()  # Install wxWidgets.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions