@staticmethod
def convert_dep_except_oe_vars(dep):
    """
        Convert dependency name to lowercase and replace '_' by '-'
        except in ${OE} variables.
        """
    BEGIN_PATTERN = '${'
    END_PATTERN = '}'
    result = ''
    begin = dep.find(BEGIN_PATTERN)
    while begin != -1:
        result += dep[:begin].lower().replace('_', '-')
        remaining = dep[begin + len(BEGIN_PATTERN):]
        end = remaining.find(END_PATTERN)
        if end == -1:
            dep = dep[begin:]
            break
        oe_var = remaining[:end]
        result += BEGIN_PATTERN + oe_var + END_PATTERN
        dep = remaining[end + len(END_PATTERN):]
        begin = dep.find(BEGIN_PATTERN)
    result += dep.lower().replace('_', '-')
    return result
