From af161d305c14eb5cc405a74cc2fd5ffabb409291 Mon Sep 17 00:00:00 2001 From: Jean Connelly Date: Thu, 15 Dec 2022 18:37:26 -0500 Subject: [PATCH 1/2] Move duplicate_package_info here --- ska_helpers/setup_helper.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 ska_helpers/setup_helper.py diff --git a/ska_helpers/setup_helper.py b/ska_helpers/setup_helper.py new file mode 100644 index 0000000..beb04b9 --- /dev/null +++ b/ska_helpers/setup_helper.py @@ -0,0 +1,23 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst + +def duplicate_package_info(vals, name_in, name_out): + """ + Duplicate a list or dict of values inplace, replacing ``name_in`` with ``name_out``. + + Normally used in setup.py for making a namespace package that copies a flat one. + For an example see setup.py in the ska_sun or Ska.Sun repo. + + :param vals: list or dict of values + :param name_in: string to replace at start of each value + :param name_out: output string + """ + import re + + for name in list(vals): + new_name = re.sub(f"^{name_in}", name_out, name) + if isinstance(vals, dict): + vals[new_name] = vals[name] + else: + vals.append(new_name) + + From a5c763359948ac714d13fd7cab3d62fda196995d Mon Sep 17 00:00:00 2001 From: Jean Connelly Date: Tue, 20 Dec 2022 11:08:13 -0500 Subject: [PATCH 2/2] Add setup_helper (and logging and retry) to docs --- docs/index.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index 4f50419..da1523b 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -9,6 +9,27 @@ Ska Package Helpers .. automodule:: ska_helpers :members: +Logging +------- + +.. automodule:: ska_helpers.logging + :members: + + +Retry +----- + +.. automodule:: ska_helpers.retry + :members: + + +Setup Helpers +------------- + +.. automodule:: ska_helpers.setup_helper + :members: + + Utilities ---------