diff options
author | Ionuț Arțăriși <iartarisi@suse.cz> | 2013-01-16 15:06:00 +0100 |
---|---|---|
committer | Ionuț Arțăriși <iartarisi@suse.cz> | 2013-01-16 15:06:59 +0100 |
commit | 1e81f95ca79d5a1b79bc86f710666148d1a5a385 (patch) | |
tree | 26201987db8925e5b72754b71ddc54b22e35e57b | |
parent | 9827528b14bbc92ead4456a967bdc7f77eaa696a (diff) | |
download | oslo-1e81f95ca79d5a1b79bc86f710666148d1a5a385.tar.gz oslo-1e81f95ca79d5a1b79bc86f710666148d1a5a385.tar.xz oslo-1e81f95ca79d5a1b79bc86f710666148d1a5a385.zip |
use regexp to parse the mailmap
this also makes parse_mailmap() work with the swift .mailmap and should
be more readable
Change-Id: I3abb2a18d655e507bee5f621ebc64421d943cf0b
-rw-r--r-- | openstack/common/setup.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/openstack/common/setup.py b/openstack/common/setup.py index 315ea87..d83f3f6 100644 --- a/openstack/common/setup.py +++ b/openstack/common/setup.py @@ -34,11 +34,12 @@ def parse_mailmap(mailmap='.mailmap'): if os.path.exists(mailmap): with open(mailmap, 'r') as fp: for l in fp: - l = l.strip() - if not l.startswith('#') and ' ' in l: - canonical_email, alias = [x for x in l.split(' ') - if x.startswith('<')] - mapping[alias] = canonical_email + try: + canonical_email, alias = re.match( + r'[^#]*?(<.+>).*(<.+>).*', l).groups() + except AttributeError: + continue + mapping[alias] = canonical_email return mapping |