From 434599cc12598c89bd1e57acbde0df0e14d585ea Mon Sep 17 00:00:00 2001 From: "Michael Hirsch, Ph.D" Date: Sun, 10 Mar 2019 03:51:31 -0400 Subject: [PATCH] Squashed commit of the following: commit b02b2d6d0d462310b313588ca7705d391e830eeb Author: Michael Hirsch, Ph.D Date: Sun Mar 10 03:51:09 2019 -0400 cleanup commit 3311ff5fb12577c78671bf2ff2787d28b86ba5fa Author: Michael Hirsch, Ph.D Date: Sun Mar 10 03:50:30 2019 -0400 more robust commit 8030dcb76698b148ee47ecded1f33b6d3821cca2 Author: Michael Hirsch, Ph.D Date: Sun Mar 10 03:30:05 2019 -0400 inwork compiles OK but needs smod filenames --- mesonbuild/backend/ninjabackend.py | 34 +++++++++++++++++------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 656ae5217..58ce7186e 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1848,8 +1848,9 @@ rule FORTRAN_DEP_HACK%s else: submodmatch = submodre.match(line) if submodmatch is not None: - # '_' is arbitrarily used to distinguish submod from mod. - submodname = '_' + submodmatch.group(2).lower() + parents = submodmatch.group(1).lower().split(':') + submodname = parents[0] + '_' + submodmatch.group(2).lower() + if submodname in submodule_files: raise InvalidArguments( 'Namespace collision: submodule %s defined in ' @@ -1907,23 +1908,26 @@ rule FORTRAN_DEP_HACK%s 'submodule ancestry must be specified as' ' ancestor:parent but Meson found {}'.parents) - if len(parents) == 2: - parents[1] = '_' + parents[1] - - for parent in parents: - if parent not in tdeps: - raise MesonException("submodule {} relies on parent module {} that was not found.".format(submodmatch.group(2).lower(), parent)) - submodsrcfile = srcdir / tdeps[parent].fname - if not submodsrcfile.is_file(): - if submodsrcfile.name != src.name: # generated source file - pass - else: # subproject - continue - elif submodsrcfile.samefile(src): # self-reference + ancestor_child = '_'.join(parents) + + if ancestor_child not in tdeps: + raise MesonException("submodule {} relies on ancestor module {} that was not found.".format(submodmatch.group(2).lower(), ancestor_child.split('_')[0])) + submodsrcfile = srcdir / tdeps[ancestor_child].fname + if not submodsrcfile.is_file(): + if submodsrcfile.name != src.name: # generated source file + pass + else: # subproject continue +<<<<<<< HEAD mod_name = compiler.module_name_to_filename(parent) mod_files.append(str(dirname / mod_name)) >>>>>>> allow fortran submodule to have same name as module +======= + elif submodsrcfile.samefile(src): # self-reference + continue + mod_name = compiler.module_name_to_filename(ancestor_child) + mod_files.append(str(dirname / mod_name)) +>>>>>>> Squashed commit of the following: mod_files = _scan_fortran_file_deps(src, srcdir, dirname, tdeps, compiler) return mod_files