2
2
import glob
3
3
import time
4
4
import os
5
+ import subprocess
5
6
from clint .textui import colored
6
7
7
8
# add user bin to path!
@@ -84,9 +85,23 @@ def run_or_die(cmd, error):
84
85
# link test library folder to the arduino libraries folder
85
86
os .symlink (BUILD_DIR , os .environ ['HOME' ]+ '/Arduino/libraries/Adafruit_Test_Library' )
86
87
88
+ ################################ Install dependancies
89
+ try :
90
+ libprop = open (BUILD_DIR + '/library.properties' )
91
+ for line in libprop :
92
+ if line .startswith ("depends=" ):
93
+ deps = line .replace ("depends=" , "" ).split ("," )
94
+ for dep in deps :
95
+ dep = dep .strip ()
96
+ run_or_die ('arduino-cli lib install "' + dep + '"' ,
97
+ "FAILED to install dependancy " + dep )
98
+ except OSError :
99
+ pass # no library properties
87
100
88
101
################################ Test platforms
89
102
platforms = sys .argv [1 :]
103
+ success = 0
104
+
90
105
for platform in platforms :
91
106
fqbn = ALL_PLATFORMS [platform ]
92
107
#print("building", platform, "full name", fqbn)
@@ -99,9 +114,21 @@ def run_or_die(cmd, error):
99
114
for filename in os .listdir (exampledir + "/" + example ):
100
115
if filename .endswith (".ino" ):
101
116
print ('\t ' + filename , end = ' ' )
102
- r = os .system ('arduino-cli compile --fqbn ' + fqbn + " " + exampledir + "/" + example + "/" + filename + ' > /dev/null' )
117
+ cmd = ['arduino-cli' , 'compile' , '--fqbn' , fqbn ,
118
+ exampledir + "/" + example + "/" + filename ]
119
+ proc = subprocess .Popen (cmd , stdout = subprocess .PIPE ,
120
+ stderr = subprocess .PIPE )
121
+ r = proc .wait ()
122
+ err = proc .stderr .read ()
123
+ out = proc .stdout .read ()
124
+ #print("OUTPUT: ", out)
125
+ #print("ERROUT: ", err)
126
+
103
127
if r == 0 :
104
128
print (colored .green (CHECK ))
105
129
else :
106
130
print (colored .red (CROSS ))
107
-
131
+ print (colored .red (err .decode ("utf-8" )))
132
+ success = 1
133
+
134
+ exit (success )
0 commit comments