From cc24a6dc6665cafbbf9c720c47b32496f9809590 Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Wed, 14 Feb 2024 15:15:44 -0500 Subject: [PATCH] fix(_usgs_src_update.py): fix function lookup in _build_replace() * replace functions are keyed by name as appears in usgsprograms.txt * lookup did not account for 'dbl' or 'd' appended to program name --- pymake/utils/_usgs_src_update.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pymake/utils/_usgs_src_update.py b/pymake/utils/_usgs_src_update.py index 6a6f666..0850ea4 100644 --- a/pymake/utils/_usgs_src_update.py +++ b/pymake/utils/_usgs_src_update.py @@ -10,6 +10,8 @@ import types from typing import Union +from ..utils.usgsprograms import usgs_program_data + def _get_function_names(module, select_name=None): """Get a dictionary of functions available in a user-specified source file. @@ -63,9 +65,13 @@ def _build_replace(targets): if isinstance(targets, str): targets = [targets] - # remove exe extension from targets + # remove exe extension from targets, as well as + # d (debug) and dbl (double precision) suffixes for idx, target in enumerate(targets): - targets[idx] = pl.Path(target).with_suffix("").name + tgt = pl.Path(target).with_suffix("").name.replace("dbl", "") + if tgt.endswith("d") and tgt[:-1] in usgs_program_data.get_keys(): + tgt = tgt[:-1] + targets[idx] = tgt # get a dictionary of update functions funcs = _get_function_names(sys.modules[__name__], select_name="_update_")