@@ -64,19 +64,22 @@ class Target:
64
64
# List of targets that were added dynamically using "add_py_targets" (see below)
65
65
__py_targets = set ()
66
66
67
- # Location of the 'targets.json' file
68
- __targets_json_location = os .path .join (os .path .dirname (os .path .abspath (__file__ )), '..' , 'hal' , 'targets.json' )
67
+ # Default location of the 'targets.json' file
68
+ __targets_json_location_default = os .path .join (os .path .dirname (os .path .abspath (__file__ )), '..' , 'hal' , 'targets.json' )
69
+
70
+ # Current/new location of the 'targets.json' file
71
+ __targets_json_location = None
69
72
70
73
# Load the description of JSON target data
71
74
@staticmethod
72
75
@cached
73
76
def get_json_target_data ():
74
- return json_file_to_dict (Target .__targets_json_location )
77
+ return json_file_to_dict (Target .__targets_json_location or Target . __targets_json_location_default )
75
78
76
79
# Set the location of the targets.json file
77
80
@staticmethod
78
- def set_targets_json_location (location ):
79
- Target .__targets_json_location = location
81
+ def set_targets_json_location (location = None ):
82
+ Target .__targets_json_location = location or Target . __targets_json_location_default
80
83
# Invalidate caches, since the location of the JSON file changed
81
84
caches .clear ()
82
85
@@ -410,7 +413,7 @@ def get_target_detect_codes():
410
413
return result
411
414
412
415
# Sets the location of the JSON file that contains the targets
413
- def set_targets_json_location (location ):
416
+ def set_targets_json_location (location = None ):
414
417
# First instruct Target about the new location
415
418
Target .set_targets_json_location (location )
416
419
# Then re-initialize TARGETS, TARGET_MAP and TARGET_NAMES
0 commit comments