Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from dmadison/ci
Update CI Versions
- Loading branch information
Showing
2 changed files
with
14 additions
and
6 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)) |