Skip to content

Commit

Permalink
Merge pull request #533 from zapta/develop
Browse files Browse the repository at this point in the history
'tinyprog' is now directoed to oss-cad-suite  (instead of to a pip packge).
  • Loading branch information
cavearr authored Jan 10, 2025
2 parents 54bbe92 + e18fbee commit 6cd40d3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
1 change: 0 additions & 1 deletion apio/resources/distribution.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"blackiceprog": ">=2.0.0,<3.0.0",
"litterbox": ">=0.2.1,<0.3.0",
"tinyfpgab": ">=1.1.0,<1.2.0",
"tinyprog": ">=1.0.21,<1.1.0",
"icefunprog": ">=2.0.3,<3.0.0",
"apycula": ">=0.12",
"apollo_fpga": ">=1.1.0"
Expand Down
3 changes: 1 addition & 2 deletions apio/resources/programmers.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
},
"tinyprog": {
"command": "tinyprog",
"args": "--pyserial -c ${SERIAL_PORT} --program",
"pip_packages": [ "tinyprog" ]
"args": "--pyserial -c ${SERIAL_PORT} --program"
},
"ujprog": {
"command": "ujprog",
Expand Down
35 changes: 18 additions & 17 deletions apio/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,32 +418,33 @@ def get_tinyprog_meta() -> list:
]'
"""

# -- Get the Apio executable folder
apio_bin_dir = get_bin_dir()

# -- Construct the command to execute
_command = apio_bin_dir / "tinyprog"

# -- Check if the executable exist
# -- In it does not exist, try with just the
# -- name: "tinyprog"
if not _command.exists():
_command = "tinyprog"
# -- Construct the command to execute. Since we exectute tinyprog from
# -- the apio packages which add to the path, we can use a simple name.
command = ["tinyprog", "--pyserial", "--meta"]
command_str = " ".join(command)

# -- Execute the command!
# -- It will return the meta information as a json string
result = exec_command([_command, "--pyserial", "--meta"])
# -- It should return the meta information as a json string
secho(command_str)
result = exec_command(command)

# pylint: disable=fixme
# TODO: Exit with an error if result.exit_code is not zero.
if result.exit_code != 0:
secho(
f"Warning: the command `{command_str}`failed with exit code "
f"{result.exit_code}",
color="yellow",
)
return []

# -- Convert the json string to an object (list)

try:
meta = json.loads(result.out_text)

except json.decoder.JSONDecodeError as exc:
secho(f"Invalid data provided by {_command}", fg="red")
secho(
f"Warning: invalid json dnvalid data provided by `{command_str}`",
fg="yellow",
)
secho(f"{exc}", fg="red")
return []

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ exclude = ["test-examples/"]
blackiceprog = ['blackiceprog==2.0.0']
litterbox = ['litterbox==0.2.2']
tinyfpgab = ['tinyfpgab==1.1.0']
tinyprog = ['tinyprog==1.0.21']
icefunprog = ['icefunprog==2.0.3']


Expand Down

0 comments on commit 6cd40d3

Please sign in to comment.