mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-22 07:44:03 -04:00
waf: ardupilotwaf: fix board env processing
Two things are fixed with this patch: 1. We sort dictionaries' keys if they aren't OrderedDict instances. Since dict objects don't guarantee order, environment variables may have contents in wrong order, causing unnecessary rebuilds. 2. We only use prepend_value() if there's already a value set for the key and that value is list. Before this change, boards couldn't set non-iterable values.
This commit is contained in:
parent
ff249788bf
commit
79b724dce8
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
from collections import OrderedDict
|
||||
import sys
|
||||
|
||||
import waflib
|
||||
@ -26,10 +27,15 @@ class Board:
|
||||
# Dictionaries (like 'DEFINES') are converted to lists to
|
||||
# conform to waf conventions.
|
||||
if isinstance(val, dict):
|
||||
for item in val.items():
|
||||
cfg.env.prepend_value(k, '%s=%s' % item)
|
||||
else:
|
||||
keys = list(val.keys())
|
||||
if not isinstance(val, OrderedDict):
|
||||
keys.sort()
|
||||
val = ['%s=%s' % (vk, val[vk]) for vk in keys]
|
||||
|
||||
if k in cfg.env and isinstance(cfg.env, list):
|
||||
cfg.env.prepend_value(k, val)
|
||||
else:
|
||||
cfg.env[k] = val
|
||||
|
||||
def configure_env(self, env):
|
||||
# Use a dictionary instead of the convetional list for definitions to
|
||||
|
Loading…
Reference in New Issue
Block a user