How to use the cmake.scripts.dom.tag._flatten_append function in cmake

To help you get started, we’ve selected a few cmake examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ryppl / ryppl / cmake / scripts / dom.py View on Github external
    @staticmethod
    def _flatten_append(l, x):
        if x is None:
            pass
        elif isinstance(x, tag):
            l.append(x.element)
        elif isinstance(x, _Element):
            l.append(x)
        elif isinstance(x,list) or isinstance(x,tuple):
            for y in x:
                tag._flatten_append(l, y)
        else:
            if len(l):
                l[-1].tail = (l[-1].tail or u'') + unicode(x)
            else:
                l.text =  (l.text or u'') + unicode(x)