From cd12a134615bd5618b36a688f6dfc59a2a771494 Mon Sep 17 00:00:00 2001 From: Felix Widmaier Date: Tue, 13 Mar 2018 02:24:58 +0100 Subject: [PATCH] Sort authors/maintainers for correct email assignment (#492) The PackageTemplate class internally sorts the authors and maintainers by their names. To ensure that email addresses are later assigned to the correct names, also sort them in the main function. --- catkin_tools/verbs/catkin_create/cli.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/catkin_tools/verbs/catkin_create/cli.py b/catkin_tools/verbs/catkin_create/cli.py index d389595f..8b836b80 100644 --- a/catkin_tools/verbs/catkin_create/cli.py +++ b/catkin_tools/verbs/catkin_create/cli.py @@ -117,6 +117,15 @@ def main(opts): try: # Get absolute path to directory containing package package_dest_path = os.path.abspath(opts.path) + + # Sort list of maintainers and authors (it will also be sorted inside + # PackageTemplate so by sorting it here, we ensure that the same order + # is used. This is important later when email addresses are assigned. + if opts.maintainers: + opts.maintainers.sort(key=lambda x: x[0]) + if opts.authors: + opts.authors.sort(key=lambda x: x[0]) + for package_name in opts.name: print('Creating package "%s" in "%s"...' % (package_name, package_dest_path)) target_path = os.path.join(package_dest_path, package_name)