From a39c7e955a535ea1ed586d4e415c9ecddf9c7414 Mon Sep 17 00:00:00 2001 From: Matthew Wall Date: Sun, 5 Jul 2015 21:52:52 -0400 Subject: [PATCH 01/11] update package changelogs --- pkg/changelog.rpm | 2 ++ pkg/debian/changelog | 3 +++ 2 files changed, 5 insertions(+) diff --git a/pkg/changelog.rpm b/pkg/changelog.rpm index 1e750ae8..86575f85 100644 --- a/pkg/changelog.rpm +++ b/pkg/changelog.rpm @@ -1,3 +1,5 @@ +* Sun Jul 05 2015 Matthew Wall (weewx) - 3.2.0a4-1 +- new upstream release * Sat Apr 25 2015 Matthew Wall (weewx) - 3.2.0a1-1 - new upstream release - use unified wee_X utilities diff --git a/pkg/debian/changelog b/pkg/debian/changelog index 8cf8c123..d90ee9a6 100644 --- a/pkg/debian/changelog +++ b/pkg/debian/changelog @@ -1,3 +1,6 @@ +weewx (3.2.0a4-1) unstable; urgency=low + * new upstream release + -- Matthew Wall (weewx) Sun, 05 Jul 2015 21:51:41 -0400 weewx (3.2.0a1-1) unstable; urgency=low * new upstream release * use unified wee_X utilities From 2c7f0b0602aecb185f3210d9a8e075b9ffaad1ca Mon Sep 17 00:00:00 2001 From: Matthew Wall Date: Mon, 6 Jul 2015 10:14:09 -0400 Subject: [PATCH 02/11] update test plan --- DEV_NOTES.txt | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/DEV_NOTES.txt b/DEV_NOTES.txt index 95d4cd03..de3c3443 100644 --- a/DEV_NOTES.txt +++ b/DEV_NOTES.txt @@ -190,15 +190,10 @@ any linux: setup.py install home=/opt/weewx on centos and suse: + - new install using rpm rpm -i weewx_x.y.z.rpm -- installation and removal of extensions - rpm -i weewx_x.y.z.rpm - wee_extension --install cmon - wee_extension --install pmon - wee_extension --remove cmon - - upgrade using rpm rpm -i weewx_r.s.t.rpm rpm -U weewx_x.y.z.rpm @@ -209,15 +204,10 @@ on centos and suse: rpm -U weewx_x.y.z.rpm debian: + - new install usinb dpkg dpkg -i weewx_x.y.z.deb -- new install using dpkg, install cmon, install pmon, remove cmon - dpkg -i weewx_x.y.z.deb - wee_extension --install cmon - wee_extension --install pmon - wee_extension --remove cmon - - upgrade using dpkg take maintainer's version of weewx.conf dpkg -i weewx_r.s.t.deb modify /etc/weewx/weewx.conf @@ -227,3 +217,20 @@ debian: dpkg -i weewx_r.s.t.deb modify /etc/weewx/weewx.conf dpkg -i weewx_x.y.z.deb + +- reconfigure using dpkg + dpkg-reconfigure weewx + +all platforms: + +- installation and removal of extensions + wee_extension --install cmon + wee_extension --install pmon + wee_extension --remove cmon + +- reconfigure using wee_config + wee_config --reconfigure + wee_config --reconfigure --driver=weewx.drivers.vantage + +- list drivers + wee_config --list-drivers From 7fe489ed3d53406c79f46ccc6179491bb8d69d89 Mon Sep 17 00:00:00 2001 From: mwall Date: Mon, 6 Jul 2015 12:20:40 -0400 Subject: [PATCH 03/11] provide feedback if driver depends on uninstalled module --- bin/weecfg/__init__.py | 48 ++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/bin/weecfg/__init__.py b/bin/weecfg/__init__.py index 46037608..39ff2d38 100644 --- a/bin/weecfg/__init__.py +++ b/bin/weecfg/__init__.py @@ -870,7 +870,8 @@ def get_driver_infos(driver_pkg_name='weewx.drivers', excludes=['__init__.py']): """Scan the drivers folder, extracting information about each available driver. Return as a dictionary, keyed by the driver module name. - Valid drivers must be importable, and must have attribute "DRIVER_NAME" defined. + Valid drivers must be importable, and must have attribute "DRIVER_NAME" + defined. """ __import__(driver_pkg_name) @@ -882,37 +883,48 @@ def get_driver_infos(driver_pkg_name='weewx.drivers', excludes=['__init__.py']): for filename in driver_list: if filename in excludes: continue + # Get the driver module name. This will be something like # 'weewx.drivers.fousb' - driver_module_name = os.path.splitext("%s.%s" % (driver_pkg_name, filename))[0] + driver_module_name = os.path.splitext("%s.%s" % (driver_pkg_name, + filename))[0] try: # Try importing the module __import__(driver_module_name) driver_module = sys.modules[driver_module_name] - except (ImportError, KeyError): - continue - - # We can detect a valid driver by whether the attribute "DRIVER_NAME" has - # been defined - if not hasattr(driver_module, 'DRIVER_NAME'): - continue - - # Now we can create an entry for it, keyed by the driver module name: - driver_info_dict[driver_module_name] = \ - {'module_name' : driver_module_name, - 'driver_name' : driver_module.DRIVER_NAME, - 'version' : driver_module.DRIVER_VERSION if hasattr(driver_module, - 'DRIVER_VERSION') else '?'} + + # A valid driver will define the attribute "DRIVER_NAME" + if hasattr(driver_module, 'DRIVER_NAME'): + # A driver might define the attribute DRIVER_VERSION + driver_module_version = driver_module.DRIVER_VERSION \ + if hasattr(driver_module, 'DRIVER_VERSION') else '?' + # Create an entry for it, keyed by the driver module name + driver_info_dict[driver_module_name] = { + 'module_name' : driver_module_name, + 'driver_name' : driver_module.DRIVER_NAME, + 'version' : driver_module_version, + 'status' : ''} + except ImportError, e: + # If the import fails, report it in the status + driver_info_dict[driver_module_name] = { + 'module_name' : driver_module_name, + 'driver_name' : '?', + 'version' : '?', + 'status' : e} + except KeyError: + pass + return driver_info_dict def print_drivers(): """Get information about all the available drivers, then print it out.""" driver_info_dict = get_all_driver_infos() keys = sorted(driver_info_dict) - print "%-25s%-25s%-25s" % ("Module name", "Driver name", "Version") + print "%-25s%-15s%-9s%-25s" % ( + "Module name", "Driver name", "Version", "Status") for d in keys: - print " %(module_name)-25s%(driver_name)-25s%(version)-25s" % driver_info_dict[d] + print " %(module_name)-25s%(driver_name)-15s%(version)-9s%(status)-25s" % driver_info_dict[d] def load_driver_editor(driver_module_name): """Load the configuration editor from the driver file From 33b4038a922349ba27533469aa766bb33739bcbe Mon Sep 17 00:00:00 2001 From: Matthew Wall Date: Mon, 6 Jul 2015 12:48:11 -0400 Subject: [PATCH 04/11] minor code reformatting (keep pycharm happy; easier to read on small monitor) --- bin/weecfg/__init__.py | 117 ++++++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 54 deletions(-) diff --git a/bin/weecfg/__init__.py b/bin/weecfg/__init__.py index 39ff2d38..2c24a416 100644 --- a/bin/weecfg/__init__.py +++ b/bin/weecfg/__init__.py @@ -31,46 +31,50 @@ major_comment_block = ["", "#################################################### # 1: A list of any subsection tuples; # 2: A list of any scalar names. -canonical_order = ('', [('Station', [], ['location', 'latitude', 'longitude', 'altitude', - 'station_type', 'rain_year_start', 'week_start']), - ('AcuRite', [], []), - ('CC3000', [], []), - ('FineOffsetUSB', [], []), - ('Simulator', [], []), - ('TE923', [], []), - ('Ultimeter', [], []), - ('Vantage', [], []), - ('WMR100', [], []), - ('WMR200', [], []), - ('WMR9x8', [], []), - ('WS1', [], []), - ('WS23xx', [], []), - ('WS28xx', [], []), - ('StdRESTful', [('StationRegistry', [], ['register_this_station']), - ('AWEKAS', [], ['enable', 'username', 'password']), - ('CWOP', [], ['enable', 'station']), - ('PWSweather', [], ['enable', 'station', 'password']), - ('WOW', [], ['enable', 'station', 'password']), - ('Wunderground', [], ['enable', 'station', 'password', 'rapidfire'])], []), - ('StdReport', [('StandardReport', [('Units', [('Groups', [], ['group_altitude', 'group_speed2', 'group_pressure', - 'group_rain', 'group_rainrate', 'group_temperature', - 'group_degree_day', 'group_speed'])], [])], ['skin']), - ('FTP', [], ['skin', 'secure_ftp', 'port', 'passive']), - ('RSYNC', [], ['skin', 'delete'])], - ['SKIN_ROOT', 'HTML_ROOT', 'data_binding']), - ('StdConvert', [], ['target_unit']), ('StdCalibrate', [('Corrections', [], [])], []), - ('StdQC', [('MinMax', [], ['barometer', 'outTemp', 'inTemp', 'outHumidity', 'inHumidity', 'windSpeed'])], []), - ('StdWXCalculate', [], ['pressure', 'barometer', 'altimeter', 'windchill', 'heatindex', 'dewpoint', 'inDewpoint', 'rainRate']), - ('StdTimeSynch', [], ['clock_check', 'max_drift']), - ('StdArchive', [], ['archive_interval', 'archive_delay', 'record_generation', 'loop_hilo', 'data_binding']), - ('DataBindings', [('wx_binding', [], ['database', 'table_name', 'manager', 'schema'])], []), - ('Databases', [('archive_sqlite', [], ['database_type', 'database_name']), - ('archive_mysql', [], ['database_type', 'database_name'])], []), - ('DatabaseTypes', [('SQLite', [], ['driver', 'SQLITE_ROOT']), - ('MySQL', [], ['driver', 'host', 'user', 'password'])], []), - ('Engine', [('Services', [], ['prep_services', 'data_services', 'process_services', - 'archive_services', 'restful_services', 'report_services'])], [])], - ['debug', 'WEEWX_ROOT', 'socket_timeout', 'version']) +canonical_order = ('', +[('Station', [], ['location', 'latitude', 'longitude', 'altitude', + 'station_type', 'rain_year_start', 'week_start']), + ('AcuRite', [], []), + ('CC3000', [], []), + ('FineOffsetUSB', [], []), + ('Simulator', [], []), + ('TE923', [], []), + ('Ultimeter', [], []), + ('Vantage', [], []), + ('WMR100', [], []), + ('WMR200', [], []), + ('WMR9x8', [], []), + ('WS1', [], []), + ('WS23xx', [], []), + ('WS28xx', [], []), + ('StdRESTful', [('StationRegistry', [], ['register_this_station']), + ('AWEKAS', [], ['enable', 'username', 'password']), + ('CWOP', [], ['enable', 'station']), + ('PWSweather', [], ['enable', 'station', 'password']), + ('WOW', [], ['enable', 'station', 'password']), + ('Wunderground', [], ['enable', 'station', 'password', 'rapidfire'])], []), + ('StdReport', [('StandardReport', [('Units', [('Groups', [], ['group_altitude', 'group_speed2', 'group_pressure', 'group_rain', 'group_rainrate', 'group_temperature', 'group_degree_day', 'group_speed'])], [])], ['skin']), + ('FTP', [], ['skin', 'secure_ftp', 'port', 'passive']), + ('RSYNC', [], ['skin', 'delete'])], + ['SKIN_ROOT', 'HTML_ROOT', 'data_binding']), + ('StdConvert', [], ['target_unit']), ('StdCalibrate', [('Corrections', [], [])], []), + ('StdQC', [('MinMax', [], ['barometer', 'outTemp', 'inTemp', + 'outHumidity', 'inHumidity', 'windSpeed'])], []), + ('StdWXCalculate', [], ['pressure', 'barometer', 'altimeter', 'windchill', + 'heatindex', 'dewpoint', 'inDewpoint', 'rainRate']), + ('StdTimeSynch', [], ['clock_check', 'max_drift']), + ('StdArchive', [], ['archive_interval', 'archive_delay', 'record_generation', + 'loop_hilo', 'data_binding']), + ('DataBindings', [('wx_binding', [], ['database', 'table_name', 'manager', + 'schema'])], []), + ('Databases', [('archive_sqlite', [], ['database_type', 'database_name']), + ('archive_mysql', [], ['database_type', 'database_name'])], []), + ('DatabaseTypes', [('SQLite', [], ['driver', 'SQLITE_ROOT']), + ('MySQL', [], ['driver', 'host', 'user', 'password'])], []), + ('Engine', [('Services', [], ['prep_services', 'data_services', + 'process_services', 'archive_services', + 'restful_services', 'report_services'])], [])], +['debug', 'WEEWX_ROOT', 'socket_timeout', 'version']) def get_section_tuple(c_dict, section_name=''): """ The above "canonical" ordering can be generated from a config file @@ -331,8 +335,9 @@ def update_and_merge(config_dict, template_dict): update_config(config_dict) merge_config(config_dict, template_dict) - # We use the number of comment lines for the 'Station' section as a heuristic - # of whether the config dict has been updated to the new comment structure + # We use the number of comment lines for the 'Station' section as a + # heuristic of whether the config dict has been updated to the new + # comment structure if len(config_dict.comments['Station']) <= 3: transfer_comments(config_dict, template_dict) @@ -525,7 +530,8 @@ def update_to_v27(config_dict): if 'StdRESTful' in config_dict and 'CWOP' in config_dict['StdRESTful']: # Option "interval" has changed to "post_interval" if 'interval' in config_dict['StdRESTful']['CWOP']: - config_dict['StdRESTful']['CWOP']['post_interval'] = config_dict['StdRESTful']['CWOP']['interval'] + config_dict['StdRESTful']['CWOP']['post_interval'] = \ + config_dict['StdRESTful']['CWOP']['interval'] config_dict['StdRESTful']['CWOP'].pop('interval') # Option "server" has become "server_list". It is also no longer # included in the default weewx.conf, so just pop it. @@ -642,15 +648,16 @@ def update_to_v32(config_dict): except KeyError: pass # Set the default [[SQLite]] section: - config_dict['DatabaseTypes'] = {'SQLite' : {'driver' : 'weedb.sqlite', - 'SQLITE_ROOT' : '%(WEEWX_ROOT)s/archive'}} + config_dict['DatabaseTypes'] = { + 'SQLite' : {'driver': 'weedb.sqlite', + 'SQLITE_ROOT': '%(WEEWX_ROOT)s/archive'}} try: root = config_dict['Databases']['archive_sqlite']['root'] database_name = config_dict['Databases']['archive_sqlite']['database_name'] fullpath = os.path.join(root, database_name) dirname = os.path.dirname(fullpath) - # By testing to see if they end up resolving to the same thing, we can keep - # the interpolation used to specify SQLITE_ROOT above: + # By testing to see if they end up resolving to the same thing, + # we can keep the interpolation used to specify SQLITE_ROOT above. if dirname != config_dict['DatabaseTypes']['SQLite']['SQLITE_ROOT']: config_dict['DatabaseTypes']['SQLite']['SQLITE_ROOT'] = dirname config_dict['Databases']['archive_sqlite']['database_name'] = os.path.basename(fullpath) @@ -666,9 +673,9 @@ def update_to_v32(config_dict): except KeyError: pass config_dict['DatabaseTypes'] = {'MySQL' : {'driver': 'weedb.mysql', - 'host' : 'localhost', - 'user' : 'weewx', - 'password' : 'weewx'}} + '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'] @@ -773,8 +780,8 @@ def get_unit_info(config_dict): # Utilities that manipulate ConfigObj objects #============================================================================== -# The following utility is probably not necessary any longer. reorder_to_ref() should -# be used instead: +# The following utility is probably not necessary any longer. +# reorder_to_ref() should be used instead. def reorder_sections(config_dict, src, dst, after=False): """Move the section with key src to just before (after=False) or after (after=True) the section with key dst. """ @@ -821,7 +828,8 @@ def reorder(name_list, ref_list): for name in ref_list: if name in name_list: result.append(name) - # For any that were not in the reference list and are left over, tack them on to the end: + # For any that were not in the reference list and are left over, tack + # them on to the end: for name in name_list: if name not in ref_list: result.append(name) @@ -929,7 +937,8 @@ def print_drivers(): def load_driver_editor(driver_module_name): """Load the configuration editor from the driver file - driver_module_name: A string holding the driver name. E.g., 'weewx.drivers.fousb' + driver_module_name: A string holding the driver name. + E.g., 'weewx.drivers.fousb' """ __import__(driver_module_name) driver_module = sys.modules[driver_module_name] From 34aec6d7a17cd11ecdf2f94d2cfcb0f6b1e50a07 Mon Sep 17 00:00:00 2001 From: Matthew Wall Date: Mon, 6 Jul 2015 14:25:53 -0400 Subject: [PATCH 05/11] fixed rpm upgrade process --- pkg/weewx.spec.in | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/pkg/weewx.spec.in b/pkg/weewx.spec.in index 8f00ab85..cad2d272 100644 --- a/pkg/weewx.spec.in +++ b/pkg/weewx.spec.in @@ -111,25 +111,32 @@ ln -s ../share/weewx/wee_reports %{buildroot}%{_bindir}/wee_reports # pre-compile the python code python -m compileall %{buildroot}%{dst_bin_dir} +%pre +if [ "$1" = "2" ]; then + # this is an upgrade + if [ -f %{cfg_file} ]; then + echo saving previous config as %{cfg_file}.prev + cp -p %{cfg_file} %{cfg_file}.prev + fi +fi + %post python -m compileall %{dst_bin_dir} if [ "$1" = "1" ]; then # this is a new installation - /usr/share/weewx/wee_config --install --dist-config=/etc/weewx/weewx.conf --output=/etc/weewx/weewx.conf --driver=weewx.drivers.simulator --no-prompt --no-backup + # create a sane configuration file with simulator as the station type + /usr/share/weewx/wee_config --install --dist-config=/etc/weewx/weewx.conf.dist --output=/etc/weewx/weewx.conf --driver=weewx.drivers.simulator --no-prompt --no-backup chkconfig weewx on %{initdir}/weewx start elif [ "$1" = "2" ]; then # this is an upgrade - # merge changes to weewx.conf - if [ -f %{cfg_file}.dist ]; then - NEWVER=`/usr/share/weewx/wee_config --version` - OLDVER=`grep version %{cfg_file} | sed -e 's/\s*version\s*=\s*//'` - echo saving previous config file as %{cfg_file}-$OLDVER - mv %{cfg_file} %{cfg_file}-$OLDVER - echo saving distribution config file as %{cfg_file}-$NEWVER - cp -p %{cfg_file}.dist %{cfg_file}-$NEWVER - echo merging previous and distribution into %{cfg_file} - /usr/share/weewx/wee_config --upgrade --config=%{cfg_file}-$OLDVER --dist-config=%{cfg_file}-$NEWVER --output=%{cfg_file} --no-prompt --no-backup + # update previous config and merge with dist into to weewx.conf + if [ -f %{cfg_file}.dist -a -f %{cfg_file}.prev ]; then + OLDVER=`grep version %{cfg_file}.prev | sed -e 's/\s*version\s*=\s*//'` + echo saving previous config as %{cfg_file}-$OLDVER + mv %{cfg_file}.prev %{cfg_file}-$OLDVER + echo merging configs into %{cfg_file} + /usr/share/weewx/wee_config --upgrade --config=%{cfg_file}-$OLDVER --dist-config=%{cfg_file}.dist --output=%{cfg_file} --no-prompt --no-backup fi # do a full restart not just a HUP %{initdir}/weewx stop From 229f89d6878adde475269e59c6be58e0d02ca2a7 Mon Sep 17 00:00:00 2001 From: mwall Date: Mon, 6 Jul 2015 15:47:07 -0400 Subject: [PATCH 06/11] provide more feedback in extension listing --- bin/weecfg/extension.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/weecfg/extension.py b/bin/weecfg/extension.py index 638fa497..c9b9976a 100644 --- a/bin/weecfg/extension.py +++ b/bin/weecfg/extension.py @@ -74,15 +74,24 @@ class ExtensionEngine(object): try: exts = os.listdir(ext_root) if exts: + msg = "%-18s%-10s%s" % ("Name", "Version", "Description") + self.logger.log(msg, level=0) for f in exts: - self.logger.log(f, level=0) + info = self.get_extension_info(f) + msg = "%(name)-18s%(version)-10s%(description)s" % info + self.logger.log(msg, level=0) else: self.logger.log("Extension cache is '%s'" % ext_root, level=2) self.logger.log("No extensions installed", level=0) except OSError: self.logger.log("No extension cache '%s'" % ext_root, level=2) self.logger.log("No extensions installed", level=0) - + + def get_extension_info(self, ext_name): + ext_cache_dir = os.path.join(self.root_dict['EXT_ROOT'], ext_name) + _, installer = weecfg.get_extension_installer(ext_cache_dir) + return installer + def install_extension(self, extension_path): """Install the extension from the file or directory extension_path""" self.logger.log("Request to install '%s'" % extension_path) From ebe6e33731491b9db21b061e3130d65bb2125d7e Mon Sep 17 00:00:00 2001 From: mwall Date: Mon, 6 Jul 2015 15:53:21 -0400 Subject: [PATCH 07/11] minor formatting changes for easier groking on small monitor --- bin/weecfg/extension.py | 53 ++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/bin/weecfg/extension.py b/bin/weecfg/extension.py index c9b9976a..731a4c2d 100644 --- a/bin/weecfg/extension.py +++ b/bin/weecfg/extension.py @@ -74,8 +74,9 @@ class ExtensionEngine(object): try: exts = os.listdir(ext_root) if exts: - msg = "%-18s%-10s%s" % ("Name", "Version", "Description") - self.logger.log(msg, level=0) + self.logger.log("%-18s%-10s%s" % + ("Extension Name", "Version", "Description"), + level=0) for f in exts: info = self.get_extension_info(f) msg = "%(name)-18s%(version)-10s%(description)s" % info @@ -124,7 +125,8 @@ class ExtensionEngine(object): # The "installer" is actually a dictionary containing what is to be # installed and where. The "installer_path" is the path to the file # containing that dictionary. - installer_path, installer = weecfg.get_extension_installer(extension_dir) + installer_path, installer = weecfg.get_extension_installer( + extension_dir) extension_name = installer.get('name', 'Unknown') self.logger.log("Found extension with name '%s'" % extension_name, level=2) @@ -148,8 +150,10 @@ class ExtensionEngine(object): # Now go through all the files of the source tuple for install_file in source_tuple[1]: source_path = os.path.join(extension_dir, install_file) - dst_file = ExtensionEngine._strip_leading_dir(install_file) - destination_path = os.path.abspath(os.path.join(self.root_dict[root_type], dst_file)) + dst_file = ExtensionEngine._strip_leading_dir( + install_file) + destination_path = os.path.abspath( + os.path.join(self.root_dict[root_type], dst_file)) self.logger.log("Copying from '%s' to '%s'" % (source_path, destination_path), level=3) @@ -169,7 +173,8 @@ class ExtensionEngine(object): # Look for options that have to be injected into the configuration file if 'config' in installer: - save_config |= self._inject_config(installer['config'], extension_name) + save_config |= self._inject_config(installer['config'], + extension_name) # Go through all the possible service groups and see if the extension # includes any services that belong in any of them. @@ -233,12 +238,12 @@ class ExtensionEngine(object): db_dict = cfg['Databases'][db] # Does this extension use the V3.2+ 'database_type' option? if 'database_type' not in db_dict: - # There is no database type specified. In this - # case, the driver type better appear. Fail hard, with - # a KeyError, if it does not. Also, if the driver is not - # for sqlite or MySQL, then we don't know anything about it. - # Assume the extension author knows what s/he is doing, and - # leave it be. + # There is no database type specified. In this case, the + # driver type better appear. Fail hard, with a KeyError, + # if it does not. Also, if the driver is not for sqlite + # or MySQL, then we don't know anything about it. + # Assume the extension author knows what s/he is doing, + # and leave it be. if db_dict['driver'] == 'weedb.sqlite': db_dict['database_type'] = 'SQLite' db_dict.pop('driver') @@ -274,11 +279,11 @@ class ExtensionEngine(object): def _reorder(self, cfg): """Reorder the resultant config_dict""" - # Patch up the location of any reports so they appear before FTP or RSYNC + # Patch up the location of any reports so they appear before FTP/RSYNC - # First, find the FTP or RSYNC reports. This has to be done on the basis - # of the skin type, rather than the report name, in case there are - # multiple FTP or RSYNC reports to be run. + # First, find the FTP or RSYNC reports. This has to be done on the + # basis of the skin type, rather than the report name, in case there + # are multiple FTP or RSYNC reports to be run. try: for report in self.config_dict['StdReport'].sections: if self.config_dict['StdReport'][report]['skin'] in ['Ftp', 'Rsync']: @@ -291,11 +296,12 @@ class ExtensionEngine(object): return # Now shuffle things so any reports that appear in the extension appear - # just before FTP (or RSYNC) and in the same order they appear in the extension - # manifest. + # just before FTP (or RSYNC) and in the same order they appear in the + # extension manifest. try: for report in cfg['StdReport']: - weecfg.reorder_sections(self.config_dict['StdReport'], report, target_name) + weecfg.reorder_sections(self.config_dict['StdReport'], + report, target_name) except KeyError: pass @@ -359,8 +365,10 @@ class ExtensionEngine(object): root_type = ExtensionEngine.target_dirs[source_type] # Now go through all the files of the source tuple for install_file in source_tuple[1]: - dst_file = ExtensionEngine._strip_leading_dir(install_file) - destination_path = os.path.abspath(os.path.join(self.root_dict[root_type], dst_file)) + dst_file = ExtensionEngine._strip_leading_dir( + install_file) + destination_path = os.path.abspath( + os.path.join(self.root_dict[root_type], dst_file)) N += self.delete_file(destination_path) if destination_path.endswith('.py'): N += self.delete_file( @@ -371,7 +379,8 @@ class ExtensionEngine(object): # delete it. This applies only to extension-specific # sub-directories. if root_type == 'SKIN_ROOT': - dst_dir = ExtensionEngine._strip_leading_dir(source_tuple[0]) + dst_dir = ExtensionEngine._strip_leading_dir( + source_tuple[0]) directory = os.path.abspath(os.path.join( self. root_dict[root_type], dst_dir)) self.delete_directory(directory) From cf0a15760130e7fc58d17b1b24ab5c17814f4d4b Mon Sep 17 00:00:00 2001 From: Matthew Wall Date: Tue, 7 Jul 2015 10:38:11 -0400 Subject: [PATCH 08/11] use mixed case for (some) derived variables --- bin/weewx/wxservices.py | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/bin/weewx/wxservices.py b/bin/weewx/wxservices.py index c5a711f9..154b1538 100644 --- a/bin/weewx/wxservices.py +++ b/bin/weewx/wxservices.py @@ -40,10 +40,10 @@ class StdWXCalculate(weewx.engine.StdService): 'dewpoint', 'inDewpoint', 'rainRate', - 'maxsolarrad', + 'maxSolarRad', 'cloudbase', 'humidex', - 'apptemp', + 'appTemp', # 'beaufort', 'ET', 'windrun', @@ -53,11 +53,12 @@ class StdWXCalculate(weewx.engine.StdService): """Initialize the calculation service. Sample configuration: [StdWXCalculate] - rain_period = 900 - et_period = 3600 ignore_zero_wind = True - atc = 0.8 - wind_height = 2.0 + rain_period = 900 # for rain rate + et_period = 3600 # for evapotranspiration + wind_height = 2.0 # for evapotranspiration + atc = 0.8 # for solar radiation RS + nfac = 2 # for solar radiation Bras max_delta_12h = 1800 [[Calculations]] windchill = hardware @@ -65,6 +66,7 @@ class StdWXCalculate(weewx.engine.StdService): dewpoint = software [[Algorithms]] altimeter = aaASOS + maxSolarRad = RS """ super(StdWXCalculate, self).__init__(engine, config_dict) @@ -228,10 +230,16 @@ class StdWXCalculate(weewx.engine.StdService): # ...then divide by the period and scale to an hour data['rainRate'] = 3600 * rainsum / self.rain_period - def calc_maxsolarrad(self, data, data_type): - data['maxsolarrad'] = weewx.wxformulas.solar_rad_RS( - self.latitude, self.longitude, self.altitude_m, data['dateTime'], - self.atc) + def calc_maxSolarRad(self, data, data_type): + algo = self.algorithms.get('maxSolarRad', 'RS') + if algo == 'Bras': + data['maxSolarRad'] = weewx.wxformulas.solar_rad_Bras( + self.latitude, self.longitude, self.altitude_m, + data['dateTime'], self.nfac) + else: + data['maxSolarRad'] = weewx.wxformulas.solar_rad_RS( + self.latitude, self.longitude, self.altitude_m, + data['dateTime'], self.atc) def calc_cloudbase(self, data, data_type): if 'outTemp' in data and 'outHumidity' in data: @@ -247,9 +255,9 @@ class StdWXCalculate(weewx.engine.StdService): else: data['humidex'] = None - def calc_apptemp(self, data, data_type): + def calc_appTemp(self, data, data_type): if 'outTemp' in data and 'outHumidity' in data and 'windSpeed' in data: - data['apptemp'] = weewx.wxformulas.apptempF( + data['appTemp'] = weewx.wxformulas.apptempF( data['outTemp'], data['outHumidity'], data['windSpeed']) else: data['apptemp'] = None @@ -343,7 +351,7 @@ class StdWXCalculate(weewx.engine.StdService): if ts12 != self.ts_12h_ago: # We're in a new interval. Hit the database to get the temperature dbmanager = self.engine.db_binder.get_manager('wx_binding') - record = dbmanager.getRecord(ts12, max_delta = self.max_delta_12h) + record = dbmanager.getRecord(ts12, max_delta=self.max_delta_12h) if record is None: # Nothing in the database. Set temperature to None. self.temperature_12h_ago = None From 71e28c735e0796fa15b691b4b113ee6258ea5ef5 Mon Sep 17 00:00:00 2001 From: Matthew Wall Date: Tue, 7 Jul 2015 11:32:56 -0400 Subject: [PATCH 09/11] SQLITE_ROOT is set to /var/lib/weewx for rpm and deb. CR/LF detection in ws1 deferred until we have solid feedback about actual station behavior. --- TODO.txt | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/TODO.txt b/TODO.txt index 0150515d..7d3f3301 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,12 +1,2 @@ TODO: items for the next release; complete list is at github ------------------------------------------------------------------------------- - -When using the Deb or RPM installer, will SQLITE_ROOT point -to / or to /var/lib/weewx? Should be latter. - -- test deb upgrades -- test wee_extension on deb system -- test rpm upgrades -- test wee_extension on rpm system -- look for CR or LF (not just CRLF) in ws1 driver - From e0914953e9a0d0739376591b961b3aaec7eeb8f4 Mon Sep 17 00:00:00 2001 From: Matthew Wall Date: Tue, 7 Jul 2015 11:49:55 -0400 Subject: [PATCH 10/11] bump version to 3.2.0b1 --- bin/weewx/__init__.py | 2 +- docs/customizing.htm | 2 +- docs/upgrading.htm | 2 +- docs/usersguide.htm | 2 +- pkg/changelog.rpm | 2 ++ pkg/debian/changelog | 3 +++ weewx.conf | 2 +- 7 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bin/weewx/__init__.py b/bin/weewx/__init__.py index a863b16e..f9921999 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.0a4" +__version__="3.2.0b1" # Holds the program launch time in unix epoch seconds: # Useful for calculating 'uptime.' diff --git a/docs/customizing.htm b/docs/customizing.htm index 0080e632..424c4d6e 100644 --- a/docs/customizing.htm +++ b/docs/customizing.htm @@ -45,7 +45,7 @@

Customizing weewx
-Version: 3.2.0a4 +Version: 3.2.0b1

diff --git a/docs/upgrading.htm b/docs/upgrading.htm index 95f050a2..4340f625 100644 --- a/docs/upgrading.htm +++ b/docs/upgrading.htm @@ -83,7 +83,7 @@ table .tty {

Upgrading weewx
-Version: 3.2.0a4 +Version: 3.2.0b1

diff --git a/docs/usersguide.htm b/docs/usersguide.htm index fa72b075..2ec6d7f9 100644 --- a/docs/usersguide.htm +++ b/docs/usersguide.htm @@ -59,7 +59,7 @@ function showtab(tab,id) {

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

diff --git a/pkg/changelog.rpm b/pkg/changelog.rpm index 86575f85..b75373c5 100644 --- a/pkg/changelog.rpm +++ b/pkg/changelog.rpm @@ -1,3 +1,5 @@ +* Tue Jul 07 2015 Matthew Wall (weewx) - 3.2.0b1-1 +- new upstream release * Sun Jul 05 2015 Matthew Wall (weewx) - 3.2.0a4-1 - new upstream release * Sat Apr 25 2015 Matthew Wall (weewx) - 3.2.0a1-1 diff --git a/pkg/debian/changelog b/pkg/debian/changelog index d90ee9a6..305a7a1c 100644 --- a/pkg/debian/changelog +++ b/pkg/debian/changelog @@ -1,3 +1,6 @@ +weewx (3.2.0b1-1) unstable; urgency=low + * new upstream release + -- Matthew Wall (weewx) Tue, 07 Jul 2015 11:49:42 -0400 weewx (3.2.0a4-1) unstable; urgency=low * new upstream release -- Matthew Wall (weewx) Sun, 05 Jul 2015 21:51:41 -0400 diff --git a/weewx.conf b/weewx.conf index 42c45fe2..d17e3db6 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.0a4 +version = 3.2.0b1 ############################################################################## From 7f505663fb7ad6f7b5a1ab1c05f9b624b24f0ce9 Mon Sep 17 00:00:00 2001 From: tkeffer Date: Tue, 7 Jul 2015 10:29:15 -0700 Subject: [PATCH 11/11] Documented directory for weewx utilities --- docs/setup.htm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/setup.htm b/docs/setup.htm index 7d34a876..b47af8b1 100644 --- a/docs/setup.htm +++ b/docs/setup.htm @@ -78,6 +78,10 @@ function showstartup(id) { configuration file: /home/weewx/weewx.conf + + utilities: + /home/weewx/bin/ + skins and templates: /home/weewx/skins/