From 6554cc52353e416a29b2f384cf4845f6d009e8ce Mon Sep 17 00:00:00 2001 From: Tom Keffer Date: Sat, 18 Jul 2015 16:38:13 -0700 Subject: [PATCH] Fixed problem when using setup.py to install into a non-standard location. Weewx would start a new database in the "standard" location, ignoring the old one in the non-standard location. --- bin/weecfg/__init__.py | 21 +++++++++++++++------ bin/weewx/__init__.py | 2 +- docs/changes.txt | 7 +++++++ docs/customizing.htm | 2 +- docs/upgrading.htm | 2 +- docs/usersguide.htm | 2 +- weewx.conf | 2 +- 7 files changed, 27 insertions(+), 11 deletions(-) diff --git a/bin/weecfg/__init__.py b/bin/weecfg/__init__.py index d3ec70e7..e87c29a4 100644 --- a/bin/weecfg/__init__.py +++ b/bin/weecfg/__init__.py @@ -379,10 +379,16 @@ def merge_config(config_dict, template_dict): template_dict: A newer dictionary supplied by the installer. """ - config_dict.interpolate = False + # Turn off interpolation so what gets merged is the symbolic name + # (such as WEEWX_ROOT), and not its interpolated value. + csave, config_dict.interpolation = config_dict.interpolation, False + tsave, template_dict.interpolation = template_dict.interpolation, False # Merge new stuff from the template: weeutil.weeutil.conditional_merge(config_dict, template_dict) + + config_dict.interpolation = csave + template_dict.interpolation = tsave # Finally, update the version number: config_dict['version'] = template_dict['version'] @@ -647,10 +653,13 @@ def update_to_v32(config_dict): assert(config_dict['Databases']['archive_sqlite']['driver'] == 'weedb.sqlite') except KeyError: pass - # Set the default [[SQLite]] section: + # Set the default [[SQLite]] section. Turn off interpolation first, so the + # symbol for WEEWX_ROOT does not get lost. + save, config_dict.interpolation = config_dict.interpolation, False config_dict['DatabaseTypes'] = { 'SQLite' : {'driver': 'weedb.sqlite', 'SQLITE_ROOT': '%(WEEWX_ROOT)s/archive'}} + config_dict.interpolation = save try: root = config_dict['Databases']['archive_sqlite']['root'] database_name = config_dict['Databases']['archive_sqlite']['database_name'] @@ -672,10 +681,10 @@ def update_to_v32(config_dict): assert(config_dict['Databases']['archive_mysql']['driver'] == 'weedb.mysql') except KeyError: pass - config_dict['DatabaseTypes'] = {'MySQL' : {'driver': 'weedb.mysql', - 'host': 'localhost', - 'user': 'weewx', - 'password': 'weewx'}} + config_dict['DatabaseTypes']['MySQL'] = {'driver': 'weedb.mysql', + 'host': 'localhost', + 'user': 'weewx', + 'password': 'weewx'} try: config_dict['DatabaseTypes']['MySQL']['host'] = config_dict['Databases']['archive_mysql']['host'] config_dict['DatabaseTypes']['MySQL']['user'] = config_dict['Databases']['archive_mysql']['user'] diff --git a/bin/weewx/__init__.py b/bin/weewx/__init__.py index d9e7bbe2..7f763a4e 100644 --- a/bin/weewx/__init__.py +++ b/bin/weewx/__init__.py @@ -6,7 +6,7 @@ """Package weewx, containing modules specific to the weewx runtime engine.""" import time -__version__="3.2.0" +__version__="3.2.1" # Holds the program launch time in unix epoch seconds: # Useful for calculating 'uptime.' diff --git a/docs/changes.txt b/docs/changes.txt index 240e18ab..0ea6d3c5 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -1,6 +1,13 @@ weewx change history -------------------- +3.2.1 07/18/15 + +Fixed problem when using setup.py to install into a non-standard location. +Weewx would start a new database in the "standard" location, ignoring the +old one in the non-standard location. + + 3.2.0 07/15/15 There are now five command-line utilities, some new, some old diff --git a/docs/customizing.htm b/docs/customizing.htm index b2ca72e3..d8ac4511 100644 --- a/docs/customizing.htm +++ b/docs/customizing.htm @@ -46,7 +46,7 @@

Customizing weewx
-Version: 3.2.0 +Version: 3.2.1

diff --git a/docs/upgrading.htm b/docs/upgrading.htm index fa046533..89989536 100644 --- a/docs/upgrading.htm +++ b/docs/upgrading.htm @@ -92,7 +92,7 @@

Upgrading weewx
-Version: 3.2.0 +Version: 3.2.1

diff --git a/docs/usersguide.htm b/docs/usersguide.htm index d14b2d5c..c456d2d5 100644 --- a/docs/usersguide.htm +++ b/docs/usersguide.htm @@ -61,7 +61,7 @@

User's Guide to the weewx Weather System
-Version: 3.2.0 +Version: 3.2.1

diff --git a/weewx.conf b/weewx.conf index 8d10f061..4f08c988 100644 --- a/weewx.conf +++ b/weewx.conf @@ -17,7 +17,7 @@ WEEWX_ROOT = /home/weewx socket_timeout = 20 # Do not modify this. It is used when installing and updating weewx. -version = 3.2.0 +version = 3.2.1 ##############################################################################