diff options
author | Colin Walters <walters@src.gnome.org> | 2008-09-20 00:03:38 +0000 |
---|---|---|
committer | Colin Walters <walters@src.gnome.org> | 2008-09-20 00:03:38 +0000 |
commit | d0a076c56818fa6e8c4c1a660c6ef6ef11cbc5fb (patch) | |
tree | 3509edb63df60e1ae95d139edcfa0b990c232a65 /giscanner/utils.py | |
parent | e88553deea8c212b66b76b69b10fcb5824150f82 (diff) | |
download | gobject-introspection-d0a076c56818fa6e8c4c1a660c6ef6ef11cbc5fb.tar.gz |
Bug 552390: Handle capitialization like "DBus" more robustly
The to_underscores function was designed for use against prefixed
names; we need a separate function which will convert names like
DBusFoo into dbus_foo, not d_bus_foo.
svn path=/trunk/; revision=621
Diffstat (limited to 'giscanner/utils.py')
-rw-r--r-- | giscanner/utils.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/giscanner/utils.py b/giscanner/utils.py index 1a45c75d..c2f6e5d8 100644 --- a/giscanner/utils.py +++ b/giscanner/utils.py @@ -37,6 +37,13 @@ def to_underscores(name): return name +def to_underscores_noprefix(name): + """Like to_underscores, but designed for "unprefixed" names. + to_underscores("DBusFoo") => dbus_foo, not d_bus_foo.""" + name = _upperstr_pat1.sub(r'\1_\2', name) + name = _upperstr_pat2.sub(r'\1_\2', name) + return name + _libtool_pat = re.compile("dlname='([A-z0-9\.\-\+]+)'\n") |