File tree Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change 1
1
import math
2
2
import os
3
3
import re
4
+ import subprocess
4
5
from bisect import bisect_left
5
6
from collections .abc import Iterable
6
7
@@ -131,19 +132,22 @@ def compile(self, model):
131
132
Returns:
132
133
string: Returns the name of the compiled library.
133
134
"""
134
- curr_dir = os .getcwd ()
135
- os .chdir (model .config .get_output_dir ())
136
135
137
136
lib_name = None
138
- try :
139
- ret_val = os .system ('bash build_lib.sh' )
140
- if ret_val != 0 :
141
- raise Exception (f'Failed to compile project "{ model .config .get_project_name ()} "' )
142
- lib_name = '{}/firmware/{}-{}.so' .format (
143
- model .config .get_output_dir (), model .config .get_project_name (), model .config .get_config_value ('Stamp' )
144
- )
145
- finally :
146
- os .chdir (curr_dir )
137
+ ret_val = subprocess .run (
138
+ ['./build_lib.sh' ],
139
+ shell = True ,
140
+ text = True ,
141
+ stdout = subprocess .PIPE ,
142
+ stderr = subprocess .STDOUT ,
143
+ cwd = model .config .get_output_dir ()
144
+ )
145
+ if ret_val .returncode != 0 :
146
+ print (ret_val .stdout )
147
+ raise Exception (f'Failed to compile project "{ model .config .get_project_name ()} "' )
148
+ lib_name = '{}/firmware/{}-{}.so' .format (
149
+ model .config .get_output_dir (), model .config .get_project_name (), model .config .get_config_value ('Stamp' )
150
+ )
147
151
148
152
return lib_name
149
153
You can’t perform that action at this time.
0 commit comments