Coverage for apio/commands/apio_drivers_install.py: 100%
20 statements
« prev ^ index » next coverage.py v7.17.2, created at 2026-11-07 05:08 +0000
« prev ^ index » next coverage.py v7.17.2, created at 2026-11-07 05:08 +0000
1# This file is part of the Apio project
2# (C) 2016-present FPGAwars
3# Project authors:
4# * Jesús Arroyo (Jesus89) (2016-2019)
5# * Juan Gonzalez (obijuan) (2019-2024)
6# * The Apio Team (2024-present)
7# License: GPLv2
9"""Implementation of 'apio drivers install' command"""
11# import sys
12import click
13from apio.managers.drivers import Drivers
14from apio.apio_context import (
15 ApioContext,
16 PackagesPolicy,
17 ProjectPolicy,
18 RemoteConfigPolicy,
19)
20from apio.utils.cmd_util import ApioGroup, ApioSubgroup, ApioCommand
23# -- apio drivers install ftdi
25# -- Text in the rich-text format of the python rich library.
26APIO_DRIVERS_INSTALL_FTDI_HELP = """
27The command 'apio drivers install ftdi' installs on your system the FTDI \
28drivers required by some FPGA boards.
30Examples:[code]
31 apio drivers install ftdi # Install the ftdi drivers.[/code]
32"""
35@click.command(
36 name="ftdi",
37 cls=ApioCommand,
38 short_help="Install the ftdi drivers.",
39 help=APIO_DRIVERS_INSTALL_FTDI_HELP,
40)
41def _ftdi_cli():
42 """Implements the 'apio drivers install ftdi' command."""
44 # -- Create the apio context.
45 apio_ctx = ApioContext(
46 project_policy=ProjectPolicy.NO_PROJECT,
47 remote_config_policy=RemoteConfigPolicy.CACHED_OK,
48 packages_policy=PackagesPolicy.ENSURE_PACKAGES,
49 )
51 # # -- Create the drivers manager.
52 drivers = Drivers(apio_ctx)
54 # -- Install.
55 drivers.ftdi_install()
58# -- apio driver install serial
60# -- Text in the rich-text format of the python rich library.
61APIO_DRIVERS_INSTALL_SERIAL_HELP = """
62The command 'apio drivers install serial' installs the necessary serial \
63drivers on your system, as required by certain FPGA boards.
65Examples:[code]
66 apio drivers install serial # Install the serial drivers.[/code]
67"""
70@click.command(
71 name="serial",
72 cls=ApioCommand,
73 short_help="Install the serial drivers.",
74 help=APIO_DRIVERS_INSTALL_SERIAL_HELP,
75)
76def _serial_cli():
77 """Implements the 'apio drivers install serial' command."""
79 # -- Create the apio context.
80 apio_ctx = ApioContext(
81 project_policy=ProjectPolicy.NO_PROJECT,
82 remote_config_policy=RemoteConfigPolicy.CACHED_OK,
83 packages_policy=PackagesPolicy.ENSURE_PACKAGES,
84 )
86 # -- Create the drivers manager.
87 drivers = Drivers(apio_ctx)
89 # Install
90 drivers.serial_install()
93# --- apio drivers install
95# -- Text in the rich-text format of the python rich library.
96APIO_DRIVERS_INSTALL_HELP = """
97The command group 'apio drivers install' includes subcommands that that \
98install system drivers that are used to upload designs to FPGA boards.
99"""
101# -- We have only a single group with the title 'Subcommands'.
102SUBGROUPS = [
103 ApioSubgroup(
104 "Subcommands",
105 [
106 _ftdi_cli,
107 _serial_cli,
108 ],
109 )
110]
113@click.command(
114 name="install",
115 cls=ApioGroup,
116 subgroups=SUBGROUPS,
117 short_help="Install drivers.",
118 help=APIO_DRIVERS_INSTALL_HELP,
119)
120def cli():
121 """Implements the 'apio drivers install' command."""
123 # pass