Skip to content

Commit

Permalink
Merge pull request #458 from zapta/develop
Browse files Browse the repository at this point in the history
Assorted changes
  • Loading branch information
Obijuan authored Nov 14, 2024
2 parents f74eea6 + b3fb706 commit d2c5bb3
Show file tree
Hide file tree
Showing 11 changed files with 153 additions and 133 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"program": "${workspaceFolder}/apio_run.py",
"args": [
"drivers",
"--ftdi-enable"
"--ftdi-install"
],
"console": "integratedTerminal",
"justMyCode": false,
Expand Down
10 changes: 6 additions & 4 deletions apio/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@
"clean",
],
"Verification commands": [
"verify",
"lint",
"sim",
"test",
"time",
"report",
"graph",
],
Expand All @@ -40,8 +38,6 @@
"modify",
"packages",
"drivers",
"install",
"uninstall",
],
"Utility commands": [
"boards",
Expand All @@ -50,6 +46,12 @@
"system",
"upgrade",
],
"Deprecated commands": [
"time",
"verify",
"install",
"uninstall",
],
}


Expand Down
83 changes: 42 additions & 41 deletions apio/commands/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,35 @@
# ---------------------------
# -- COMMAND SPECIFIC OPTIONS
# ---------------------------
frdi_enable_option = click.option(
"ftdi_enable", # Var name.
"--ftdi-enable",
ftdi_install_option = click.option(
"ftdi_install", # Var name.
"--ftdi-install",
is_flag=True,
help="Enable FTDI drivers.",
help="Install the FTDI driver.",
cls=cmd_util.ApioOption,
)

ftdi_disable_option = click.option(
"ftdi_disable", # Var name.
"--ftdi-disable",
ftdi_uninstall_option = click.option(
"ftdi_uninstall", # Var name.
"--ftdi-uninstall",
is_flag=True,
help="Disable FTDI drivers.",
help="Uninstall the FTDI driver.",
cls=cmd_util.ApioOption,
)

serial_enable_option = click.option(
"serial_enable", # Var name.
"--serial-enable",
serial_install_option = click.option(
"serial_install", # Var name.
"--serial-install",
is_flag=True,
help="Enable Serial drivers.",
help="Install the Serial driver.",
cls=cmd_util.ApioOption,
)

serial_disable_option = click.option(
"serial_disable", # Var name.
"--serial-disable",
serial_uninstall_option = click.option(
"serial_uninstall", # Var name.
"--serial-uninstall",
is_flag=True,
help="Disable Serial drivers.",
help="Uninstall the Serial driver.",
cls=cmd_util.ApioOption,
)

Expand All @@ -61,10 +61,10 @@
\b
Examples:
apio drivers --ftdi-enable # Install FTDI driver
apio drivers --ftdi-disable # Uninstall FTDI driver
apio drivers --serial-enable # Install serial driver
apio drivers --serial-disable # Uninstall serial driver
apio drivers --ftdi-install # Install the FTDI driver.
apio drivers --ftdi-uninstall # Uninstall the FTDI driver.
apio drivers --serial-install # Install the serial driver.
apio drivers --serial-uninstall # Uninstall the serial driver.
Do not specify more than flag per command invocation.
"""
Expand All @@ -77,47 +77,48 @@
cls=cmd_util.ApioCommand,
)
@click.pass_context
@frdi_enable_option
@ftdi_disable_option
@serial_enable_option
@serial_disable_option
@ftdi_install_option
@ftdi_uninstall_option
@serial_install_option
@serial_uninstall_option
def cli(
ctx: Context,
# Options:
ftdi_enable: bool,
ftdi_disable: bool,
serial_enable: bool,
serial_disable: bool,
ftdi_install: bool,
ftdi_uninstall: bool,
serial_install: bool,
serial_uninstall: bool,
):
"""Implements the drivers command."""

# Make sure these params are exclusive.
cmd_util.check_at_most_one_param(
ctx, nameof(ftdi_enable, ftdi_disable, serial_enable, serial_disable)
ctx,
nameof(ftdi_install, ftdi_uninstall, serial_install, serial_uninstall),
)

# -- Access to the Drivers
resources = Resources(project_scope=False)
drivers = Drivers(resources)

# -- FTDI enable option
if ftdi_enable:
exit_code = drivers.ftdi_enable()
# -- FTDI install option
if ftdi_install:
exit_code = drivers.ftdi_install()
ctx.exit(exit_code)

# -- FTDI disable option
if ftdi_disable:
exit_code = drivers.ftdi_disable()
# -- FTDI uninstall option
if ftdi_uninstall:
exit_code = drivers.ftdi_uninstall()
ctx.exit(exit_code)

# -- Serial enable option
if serial_enable:
exit_code = drivers.serial_enable()
# -- Serial install option
if serial_install:
exit_code = drivers.serial_install()
ctx.exit(exit_code)

# -- Serial disable option
if serial_disable:
exit_code = drivers.serial_disable()
# -- Serial uninstall option
if serial_uninstall:
exit_code = drivers.serial_uninstall()
ctx.exit(exit_code)

# -- No options. Show the help
Expand Down
4 changes: 2 additions & 2 deletions apio/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def install_packages(
# -- COMMAND
# ---------------------------
HELP = """
The install command has been deprecated. Please use the 'apio packages' command
instead.
The command 'apio install' has been deprecated. Please use the command
'apio packages' command instead.
"""


Expand Down
4 changes: 2 additions & 2 deletions apio/commands/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
# -- COMMAND
# ---------------------------
HELP = """
The time command has been deprecated. Please use the 'apio report' command
instead.
The command 'apio time' has been deprecated. Please use the command
'apio report' instead.
"""


Expand Down
4 changes: 2 additions & 2 deletions apio/commands/uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def _uninstall(
# -- COMMAND
# ---------------------------
HELP = """
The uninstall command has been deprecated. Please use the 'apio packages'
command instead.
The command 'apio uninstall' has been deprecated. Please use the
command 'apio packages' instead.
"""


Expand Down
15 changes: 3 additions & 12 deletions apio/commands/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,14 @@
# ---------------------------

HELP = """
The verify command performs a shallow verification of the verilog code
it finds without requiring a top module or a constraint file.
Is useful mainly in early stages of the project, before the
strictier build and lint commands can be used.
The verify commands is typically used in the root directory
of the project that contains the apio.ini file.
\b
Examples:
apio verify
The command 'apio verify' has been deprecated. Please use the command
'apio lint' instead.
"""


@click.command(
"verify",
short_help="Verify the verilog code.",
short_help="[Depreciated] Verify the verilog code.",
help=HELP,
cls=cmd_util.ApioCommand,
)
Expand Down
Loading

0 comments on commit d2c5bb3

Please sign in to comment.