Skip to content

Commit 77771aa

Browse files
committed
add fix for latest platformio build changes
1 parent 4bb4871 commit 77771aa

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.pio
12
.pioenvs
23
.piolibdeps
34
.clang_complete

timelib_fix.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,22 @@ def findSubDirectoryFiles(root, subDirectoryPattern, fileName):
1515
result.append(candidateFile)
1616
return result
1717

18-
# lib deps directory
19-
libDepsDir = os.path.join(env.subst('$PROJECT_DIR'), '.piolibdeps')
20-
timeHeaderFile = "Time.h"
21-
timeLibDirectoryPattern = "Time(_ID[0-9]+)?"
18+
def deleteTimeHeader(libDepsDir):
19+
timeHeaderFile = "Time.h"
20+
timeLibDirectoryPattern = "Time(_ID[0-9]+)?"
2221

23-
# delete the file, as long as we only find one
24-
if os.path.isdir(libDepsDir) :
25-
deletionCandidates = findSubDirectoryFiles(libDepsDir, timeLibDirectoryPattern, timeHeaderFile)
26-
numDeletionCandidates = len(deletionCandidates)
27-
if numDeletionCandidates == 1:
28-
os.remove(deletionCandidates[0])
29-
elif numDeletionCandidates > 1:
30-
os.write(2, 'Can\'t delete Time.h, more than one instance found:\n' + '\n'.join(deletionCandidates))
31-
sys.exit(1)
22+
# delete the file, as long as we only find one
23+
if os.path.isdir(libDepsDir) :
24+
deletionCandidates = findSubDirectoryFiles(libDepsDir, timeLibDirectoryPattern, timeHeaderFile)
25+
numDeletionCandidates = len(deletionCandidates)
26+
if numDeletionCandidates == 1:
27+
os.remove(deletionCandidates[0])
28+
elif numDeletionCandidates > 1:
29+
os.write(2, 'Can\'t delete Time.h, more than one instance found:\n' + '\n'.join(deletionCandidates))
30+
sys.exit(1)
31+
32+
# old lib deps directory
33+
deleteTimeHeader(os.path.join(env.subst('$PROJECT_DIR'), '.piolibdeps'))
34+
35+
# new lib deps directory
36+
deleteTimeHeader(os.path.join(env.subst('$PROJECTLIBDEPS_DIR'), env.subst('$PIOENV')))

0 commit comments

Comments
 (0)