Browse Source

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.
master
Gustavo Jose de Sousa 9 years ago committed by Lucas De Marchi
parent
commit
79b724dce8
  1. 12
      Tools/ardupilotwaf/boards.py

12
Tools/ardupilotwaf/boards.py

@ -1,6 +1,7 @@ @@ -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: @@ -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…
Cancel
Save