1717
1818 init (autoreset = True )
1919
20- path_config_filename = "path_config.json"
2120home = os .path .expanduser ("~" )
2221tempdir = tempfile .gettempdir ()
2322build_id = time .strftime ("_%Y-%m-%d_%H-%M-%S" )
2423script_path = os .path .dirname (os .path .abspath (__file__ ))
24+ path_config_filename = os .path .join (script_path , "path_config.json" )
2525
2626arduino_cli_path = ""
2727stm32_url = "https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json"
3939
4040# Default
4141sketch_default = os .path .join (script_path , "examples" , "BareMinimum" )
42- exclude_file_default = os .path .join ("conf" , "exclude_list.txt" )
43- cores_config_file_default = os .path .join ("conf" , "cores_config.json" )
44- cores_config_file_ci = os .path .join ("conf" , "cores_config_ci.json" )
45- path_config_ci_filename = os .path .join ("conf" , "path_config_ci.json" )
42+ exclude_file_default = os .path .join (script_path , "conf" , "exclude_list.txt" )
43+ cores_config_file_default = os .path .join (script_path , "conf" , "cores_config.json" )
44+ cores_config_file_ci = os .path .join (script_path , "conf" , "cores_config_ci.json" )
4645
4746maintainer_default = "STM32"
4847arch_default = "stm32"
@@ -132,10 +131,10 @@ def create_config():
132131 # Create a Json file for a better path management
133132 print (
134133 "'{}' file created. Please check the configuration." .format (
135- os . path . join ( script_path , path_config_filename )
134+ path_config_filename
136135 )
137136 )
138- path_config_file = open (os . path . join ( script_path , path_config_filename ) , "w" )
137+ path_config_file = open (path_config_filename , "w" )
139138 path_config_file .write (
140139 json .dumps (
141140 {
@@ -160,11 +159,9 @@ def check_config():
160159 global output_dir
161160 global log_file
162161 if args .ci is False :
163- if os .path .isfile (os . path . join ( script_path , path_config_filename ) ):
162+ if os .path .isfile (path_config_filename ):
164163 try :
165- path_config_file = open (
166- os .path .join (script_path , path_config_filename ), "r"
167- )
164+ path_config_file = open (path_config_filename , "r" )
168165 path_config = json .load (path_config_file )
169166 # Common path
170167 arduino_cli_path = path_config ["ARDUINO_CLI_PATH" ]
@@ -244,9 +241,10 @@ def load_core_config():
244241 cores_config_filename = cores_config_file_ci
245242 else :
246243 cores_config_filename = cores_config_file_default
247- print ("Cores configuration JSON file that will be used: " + cores_config_filename )
244+ print ("Cores configuration JSON file that will be used:" )
245+ print (cores_config_filename )
248246 try :
249- cores_config_file = open (os . path . join ( script_path , cores_config_filename ) , "r" )
247+ cores_config_file = open (cores_config_filename , "r" )
250248 cores_config = json .load (cores_config_file )
251249 cores_config_file .close ()
252250
@@ -859,7 +857,7 @@ def build(build_conf):
859857 then applicable to all board. Default core configuration is for '"
860858 + arch_default
861859 + " 'architecture in: "
862- + os . path . join ( script_path , cores_config_file_default ) ,
860+ + cores_config_file_default ,
863861)
864862
865863parser .add_argument (
@@ -897,7 +895,7 @@ def build(build_conf):
897895 metavar = "<excluded sketches list filepath>" ,
898896 help = "file containing sketches pattern to ignore.\
899897 Default path : "
900- + os . path . join ( script_path , exclude_file_default ) ,
898+ + exclude_file_default ,
901899)
902900
903901args = parser .parse_args ()
0 commit comments