diff options
Diffstat (limited to 'weewx/setup.py-Add-config-name-option.patch')
| -rw-r--r-- | weewx/setup.py-Add-config-name-option.patch | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/weewx/setup.py-Add-config-name-option.patch b/weewx/setup.py-Add-config-name-option.patch new file mode 100644 index 0000000..63eb64a --- /dev/null +++ b/weewx/setup.py-Add-config-name-option.patch @@ -0,0 +1,80 @@ +From 7eda0d89745de97d0d0299e0d68e4fd839bd4145 Mon Sep 17 00:00:00 2001 +From: Jon duSaint <jon@rockgeeks.net> +Date: Mon, 1 Aug 2022 17:15:28 -0700 +Subject: [PATCH] setup.py: Add --config-name option + +This is used to tell wee_config where to put the output weewx.conf file. +--- + setup.py | 23 +++++++++++++++-------- + 1 file changed, 15 insertions(+), 8 deletions(-) + +diff --git a/setup.py b/setup.py +index fecd57a..96fc309 100755 +--- a/setup.py ++++ b/setup.py +@@ -48,15 +48,17 @@ this_dir = os.path.abspath(os.path.dirname(this_file)) + # ============================================================================== + + class weewx_install(install): +- """Specialized version of install, which adds a '--no-prompt' option, and which runs a +- wee_config post-install script""" ++ """Specialized version of install, which adds '--no-prompt' and '--config-name' options, ++ and which runs a wee_config post-install script""" + +- # Add an option for --no-prompt. This will be passed on to wee_config +- user_options = install.user_options + [('no-prompt', None, 'Do not prompt for station info')] ++ # Add options for --no-prompt and --config-name to be passed on to wee_config ++ user_options = install.user_options + [('no-prompt', None, 'Do not prompt for station info'), ++ ('config-name=', None, 'Output config file')] + + def initialize_options(self, *args, **kwargs): + install.initialize_options(self, *args, **kwargs) + self.no_prompt = None ++ self.config_name = 'weewx.conf' + + def finalize_options(self): + # Call my superclass's version +@@ -76,7 +78,7 @@ class weewx_install(install): + + # Now the post-install + update_and_install_config(self.install_data, self.install_scripts, self.install_lib, +- self.no_prompt) ++ self.no_prompt, self.config_name) + + return rv + +@@ -250,7 +252,12 @@ def update_and_install_config(install_dir, install_scripts, install_lib, no_prom + """ + + # This is where the weewx.conf file will go +- config_path = os.path.join(install_dir, config_name) ++ dist_config_path = os.path.join(install_dir, os.path.basename(config_name)) ++ ++ if os.path.isabs(config_name): ++ config_path = config_name ++ else: ++ config_path = dist_config_path + + # Is there an existing file? + if os.path.isfile(config_path): +@@ -259,7 +266,7 @@ def update_and_install_config(install_dir, install_scripts, install_lib, no_prom + os.path.join(install_scripts, 'wee_config'), + '--upgrade', + '--config=%s' % config_path, +- '--dist-config=%s' % config_path + '.' + VERSION, ++ '--dist-config=%s' % dist_config_path + '.' + VERSION, + '--output=%s' % config_path, + ] + else: +@@ -267,7 +274,7 @@ def update_and_install_config(install_dir, install_scripts, install_lib, no_prom + args = [sys.executable, + os.path.join(install_scripts, 'wee_config'), + '--install', +- '--dist-config=%s' % config_path + '.' + VERSION, ++ '--dist-config=%s' % dist_config_path + '.' + VERSION, + '--output=%s' % config_path, + ] + # Add the --no-prompt flag if the user requested it. +-- +2.35.1 + |
