Skip to content

Commit 8891ed1

Browse files
authored
Merge pull request #2341 from screamerbg/backported-fixes
[Tools] Build system improvements
2 parents a6ffdd4 + a4c3469 commit 8891ed1

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

tools/targets.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,22 @@ class Target:
6464
# List of targets that were added dynamically using "add_py_targets" (see below)
6565
__py_targets = set()
6666

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
6972

7073
# Load the description of JSON target data
7174
@staticmethod
7275
@cached
7376
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)
7578

7679
# Set the location of the targets.json file
7780
@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
8083
# Invalidate caches, since the location of the JSON file changed
8184
caches.clear()
8285

@@ -410,7 +413,7 @@ def get_target_detect_codes():
410413
return result
411414

412415
# 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):
414417
# First instruct Target about the new location
415418
Target.set_targets_json_location(location)
416419
# Then re-initialize TARGETS, TARGET_MAP and TARGET_NAMES

tools/toolchains/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,9 @@ def compile_queue(self, queue, objects):
794794
])
795795
objects.append(result['object'])
796796
except ToolException, err:
797+
if p._taskqueue.queue:
798+
p._taskqueue.queue.clear()
799+
sleep(0.5)
797800
p.terminate()
798801
p.join()
799802
raise ToolException(err)

0 commit comments

Comments
 (0)