@@ -15,17 +15,22 @@ def findSubDirectoryFiles(root, subDirectoryPattern, fileName):
15
15
result .append (candidateFile )
16
16
return result
17
17
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]+)?"
22
21
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