build.dsl: allow strings to be used as connector numbers.

Fixes #311.
This commit is contained in:
Jaro Habiger 2020-01-26 18:35:41 +01:00 committed by whitequark
parent 7792a6cd9f
commit ec3a21939e
2 changed files with 25 additions and 4 deletions

View file

@ -14,8 +14,9 @@ class Pins:
if conn is not None:
conn_name, conn_number = conn
if not (isinstance(conn_name, str) and isinstance(conn_number, int)):
raise TypeError("Connector must be None or a pair of string and integer, not {!r}"
if not (isinstance(conn_name, str) and isinstance(conn_number, (int, str))):
raise TypeError("Connector must be None or a pair of string (connector name) and "
"integer/string (connector number), not {!r}"
.format(conn))
names = ["{}_{}:{}".format(conn_name, conn_number, name) for name in names]
@ -236,8 +237,9 @@ class Connector:
if conn is not None:
conn_name, conn_number = conn
if not (isinstance(conn_name, str) and isinstance(conn_number, int)):
raise TypeError("Connector must be None or a pair of string and integer, not {!r}"
if not (isinstance(conn_name, str) and isinstance(conn_number, (int, str))):
raise TypeError("Connector must be None or a pair of string (connector name) and "
"integer/string (connector number), not {!r}"
.format(conn))
for conn_pin, plat_pin in mapping.items():