Support initial underscores in dbus codegen namespace

Before these were considered lowercase and thus got duplicated.
This commit is contained in:
Alexander Larsson 2012-04-16 09:55:29 +02:00
parent 415a8d81f6
commit ff92fe9593

View File

@ -44,7 +44,14 @@ def camel_case_to_uscore(s):
ret = '' ret = ''
insert_uscore = False insert_uscore = False
prev_was_lower = False prev_was_lower = False
initial = True;
for c in s: for c in s:
# Keep initial underscores in camel case
if initial and c == '_':
ret += '_'
continue;
initial = False
if c.isupper(): if c.isupper():
if prev_was_lower: if prev_was_lower:
insert_uscore = True insert_uscore = True