Board's gcc_options parameter can be a sequence
authorTimo Savola <tsavola@movial.fi>
Thu, 22 May 2008 11:43:05 +0000 (14:43 +0300)
committerTimo Savola <tsavola@movial.fi>
Thu, 22 May 2008 11:44:03 +0000 (14:44 +0300)
the attribute is always a list for later manipulated.

matrix/build.py
matrix/config.py

index d21525f..2c728be 100644 (file)
@@ -308,7 +308,7 @@ def spawn(c, action):
                MATRIX_GCC_MARCH   = board.gcc_march,
                MATRIX_GCC_MCPU    = board.gcc_mcpu,
                MATRIX_GCC_MFPU    = board.gcc_mfpu,
-               MATRIX_GCC_OPTIONS = board.gcc_options,
+               MATRIX_GCC_OPTIONS = ' '.join(board.gcc_options),
                MATRIX_GNU_HOST    = board.gnu_host,
                MATRIX_LIBC        = config.libc,
        )
index 3f8ab6c..966983c 100644 (file)
@@ -11,6 +11,15 @@ Error = RuntimeError
 
 exclude = sre.compile(r'^[.#].*|.*[~#]$')
 
+def _make_list(arg):
+       if arg is None:
+               return []
+
+       if isinstance(arg, basestring):
+               return arg.split()
+
+       return list(arg)
+
 class Board(object):
        def __init__(self, name, arch, gcc_march,
                     gcc_mcpu=None,
@@ -24,12 +33,13 @@ class Board(object):
                     ubifs_max_leb_count=0,
                     ubifs_min_io_size=0,
                     ubinize_config_vol_size=0):
+
                self.name = name
                self.arch = arch
                self.gcc_march = gcc_march
                self.gcc_mcpu = gcc_mcpu or ''
                self.gcc_mfpu = gcc_mfpu or ''
-               self.gcc_options = gcc_options or ''
+               self.gcc_options = _make_list(gcc_options)
                self.gnu_host = gnu_host or ''
                self.flash_erase_size = flash_erase_size
                self.flash_pad_size = flash_pad_size