Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wippersnapper preprocessor script for printing the library versions to boot outtxt #196

Open
wants to merge 2 commits into
base: ci-wippersnapper
Choose a base branch
from

Conversation

tyeth
Copy link
Contributor

@tyeth tyeth commented Oct 10, 2024

@brentru this is tied in with adafruit/Adafruit_Wippersnapper_Arduino#607

It adds a new flag to allow specifying the location of the header file to be generated/replaced --include_print_dependencies_header although now I've settled on not being able to modify the build flags I could probably pick a better name as it no longer adds an extra include to the build flags.

Copy link
Member

@brentru brentru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tyeth Requesting some changes and clarifications before I can merge

# check argument not null and folder path exists
PRINT_DEPENDENCIES_AS_HEADER_FILENAME = sys.argv[sys.argv.index("--include_print_dependencies_header") + 1] if len(sys.argv) > sys.argv.index("--include_print_dependencies_header") + 1 else None
if PRINT_DEPENDENCIES_AS_HEADER_FILENAME is None or not os.path.exists(PRINT_DEPENDENCIES_AS_HEADER_FILENAME):
raise AttributeError("Header file path not found or not provided to --include_print_dependencies_header argument")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raise a ValueError instead

PRINT_DEPENDENCIES_AS_HEADER_FILENAME = None
if "--include_print_dependencies_header" in sys.argv:
# check argument not null and folder path exists
PRINT_DEPENDENCIES_AS_HEADER_FILENAME = sys.argv[sys.argv.index("--include_print_dependencies_header") + 1] if len(sys.argv) > sys.argv.index("--include_print_dependencies_header") + 1 else None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're re-calculating sys.argv.index, it happens here and on L42. Instead, try storing the sys.argv.index into an index variable at the top of this conditional

@@ -104,7 +114,7 @@ def manually_install_esp32_bsp(repo_info):
# Assemble git url
repo_url = "git clone -b {0} https:/{1}/arduino-esp32.git esp32".format(repo_info.split("/")[1], repo_info.split("/")[0])
# Locally clone repo (https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html#linux)
os.system("mkdir -p /home/runner/Arduino/hardware/espressif")
subprocess.run("mkdir -p /home/runner/Arduino/hardware/espressif", shell=True, check=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being changed from os.system?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, check the subprocess.run result (result = subproces.run(..)) after this operation on L117. You do this a in the calls below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants