Skip to content

Commit

Permalink
ci(variant): clean up useless code
Browse files Browse the repository at this point in the history
apply black

Signed-off-by: Frederic Pillon <[email protected]>
  • Loading branch information
fpistm committed Apr 8, 2024
1 parent ae68ec1 commit 37ddbc4
Showing 1 changed file with 10 additions and 40 deletions.
50 changes: 10 additions & 40 deletions CI/update/stm32variant.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,6 @@ def update_file(filePath, compile_pattern, subs):
file.write(fileContents)


# get xml family
def get_mcu_family(mcu_file):
xml_mcu = parse(str(mcu_file))
mcu_node = xml_mcu.getElementsByTagName("Mcu")[0]
mcu_family = mcu_node.attributes["Family"].value
if mcu_family.endswith("+"):
mcu_family = mcu_family[:-1]
xml_mcu.unlink()
return mcu_family


# mcu file parsing
def parse_mcu_file():
global gpiofile
Expand Down Expand Up @@ -908,9 +897,11 @@ def can_pinmap(lst):
)
return dict(
name=name,
hal=["CAN", "CAN_LEGACY"]
if name != "FDCAN" and any(mcu in mcu_family for mcu in legacy_hal["CAN"])
else name,
hal=(
["CAN", "CAN_LEGACY"]
if name != "FDCAN" and any(mcu in mcu_family for mcu in legacy_hal["CAN"])
else name
),
aname=aname,
data="",
wpin=max(wpin) + 1,
Expand Down Expand Up @@ -939,9 +930,11 @@ def eth_pinmap():
)
return dict(
name="ETHERNET",
hal=["ETH", "ETH_LEGACY"]
if any(mcu in mcu_family for mcu in legacy_hal["ETH"])
else "ETH",
hal=(
["ETH", "ETH_LEGACY"]
if any(mcu in mcu_family for mcu in legacy_hal["ETH"])
else "ETH"
),
aname="Ethernet",
data="",
wpin=max(wpin) + 1,
Expand Down Expand Up @@ -2501,7 +2494,6 @@ def manage_repo():
templates_dir = script_path / "templates"
mcu_family_dir = ""
filtered_family = ""
# filtered_mcu_file = ""
periph_c_filename = "PeripheralPins.c"
pinvar_h_filename = "PinNamesVar.h"
config_filename = script_path / "variant_config.json"
Expand Down Expand Up @@ -2553,18 +2545,6 @@ def manage_repo():
help="list available xml files description in database",
action="store_true",
)
# group.add_argument(
# "-m",
# "--mcu",
# metavar="xml",
# help=textwrap.dedent(
# """\
# Generate all files for specified mcu xml file description in database.
# This xml file can contain non alpha characters in its name,
# you should call it with double quotes.
# """
# ),
# )

group.add_argument(
"-f",
Expand Down Expand Up @@ -2627,16 +2607,6 @@ def manage_repo():
db_release = release_match.group(1)
print(f"CubeMX DB release {db_release}\n")

# if args.mcu:
# # Check input file exists
# if not ((dirMCU / args.mcu).is_file()):
# print("\n" + args.mcu + " file not found")
# print("\nCheck in " + dirMCU + " the correct name of this file")
# print("\nYou may use double quotes for file containing special characters")
# quit()
# # Get the family of the desired mcu file
# filtered_mcu_file = dirMCU / args.mcu
# filtered_family = get_mcu_family(filtered_mcu_file)
if args.family:
filtered_family = args.family.upper()
# Get all xml files
Expand Down

0 comments on commit 37ddbc4

Please sign in to comment.