-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Teensyduino 1.55 Compatibility (#24)
* Teensyduino 1.55 Compatibility * Update CI software versions * Update Teensyduino version in README (1.55) * Update TeensyLoader removal script The postbuild hook is now "postbuild.1" instead of "postbuild.3". This switches to regex (0-9) to avoid this issue for the future, and will now throw a runtime error if the build hook is not successfully found and removed by the script.
- Loading branch information
Showing
5 changed files
with
45 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
#!/usr/bin/python | ||
|
||
import sys | ||
import re | ||
|
||
filepath = sys.argv[1] | ||
lines = [] | ||
filepath = sys.argv[1] # path of the file to parse | ||
lines = [] # list of lines from the file | ||
removed = False # flag for if the line was removed from the file | ||
|
||
with open(filepath, 'r') as f: | ||
lines = f.readlines() | ||
|
||
with open(filepath, 'w') as f: | ||
# matching "postbuild" hooks of any number which call the "teensy_post_compile" application | ||
pattern = re.compile("recipe\.hooks\.postbuild\.[0-9]\.pattern=\"{compiler\.path}teensy_post_compile\"") | ||
for line in lines: | ||
if not line.startswith("recipe.hooks.postbuild.3.pattern=\"{compiler.path}teensy_post_compile\""): # remove post-compile trigger | ||
if not pattern.match(line): | ||
f.write(line) | ||
else: | ||
print("Removing line '{}'".format(line.strip('\n'))) | ||
removed = True | ||
|
||
if not removed: | ||
raise RuntimeError("Did not find a matching line to remove in \"{}\"".format(filepath)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters