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 11import math
22import os
33import re
4+ import subprocess
45from bisect import bisect_left
56from collections .abc import Iterable
67
@@ -131,19 +132,22 @@ def compile(self, model):
131132 Returns:
132133 string: Returns the name of the compiled library.
133134 """
134- curr_dir = os .getcwd ()
135- os .chdir (model .config .get_output_dir ())
136135
137136 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+ )
147151
148152 return lib_name
149153
You can’t perform that action at this time.
0 commit comments