mirror of
https://github.com/weewx/weewx.git
synced 2026-04-27 04:57:19 -04:00
Merge branch 'master' of https://github.com/weewx/weewx.git
This commit is contained in:
@@ -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
|
||||
|
||||
10
TODO.txt
10
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
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -870,7 +878,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,42 +891,54 @@ 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
|
||||
|
||||
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]
|
||||
|
||||
@@ -74,15 +74,25 @@ class ExtensionEngine(object):
|
||||
try:
|
||||
exts = os.listdir(ext_root)
|
||||
if exts:
|
||||
self.logger.log("%-18s%-10s%s" %
|
||||
("Extension Name", "Version", "Description"),
|
||||
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)
|
||||
@@ -115,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)
|
||||
@@ -139,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)
|
||||
@@ -160,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.
|
||||
@@ -224,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')
|
||||
@@ -265,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']:
|
||||
@@ -282,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
|
||||
|
||||
@@ -350,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(
|
||||
@@ -362,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)
|
||||
|
||||
@@ -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.'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</a>
|
||||
<h1 class="title">Customizing weewx<br />
|
||||
<span class="version">
|
||||
Version: 3.2.0a4
|
||||
Version: 3.2.0b1
|
||||
</span>
|
||||
</h1>
|
||||
|
||||
|
||||
@@ -78,6 +78,10 @@ function showstartup(id) {
|
||||
<td align='right'>configuration file: </td>
|
||||
<td class='tty'>/home/weewx/weewx.conf</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='right'>utilities: </td>
|
||||
<td class='tty'>/home/weewx/bin/</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='right'>skins and templates: </td>
|
||||
<td class='tty'>/home/weewx/skins/</td>
|
||||
|
||||
@@ -83,7 +83,7 @@ table .tty {
|
||||
</a>
|
||||
<h1 class="title">Upgrading <span class="code">weewx</span><br/>
|
||||
<span class='version'>
|
||||
Version: 3.2.0a4
|
||||
Version: 3.2.0b1
|
||||
</span>
|
||||
</h1>
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ function showtab(tab,id) {
|
||||
</a>
|
||||
<h1 class="title">User's Guide to the weewx Weather System<br />
|
||||
<span class='version'>
|
||||
Version: 3.2.0a4
|
||||
Version: 3.2.0b1
|
||||
</span>
|
||||
</h1>
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
* Tue Jul 07 2015 Matthew Wall (weewx) <mwall@users.sourceforge.net> - 3.2.0b1-1
|
||||
- new upstream release
|
||||
* Sun Jul 05 2015 Matthew Wall (weewx) <mwall@users.sourceforge.net> - 3.2.0a4-1
|
||||
- new upstream release
|
||||
* Sat Apr 25 2015 Matthew Wall (weewx) <mwall@users.sourceforge.net> - 3.2.0a1-1
|
||||
- new upstream release
|
||||
- use unified wee_X utilities
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
weewx (3.2.0b1-1) unstable; urgency=low
|
||||
* new upstream release
|
||||
-- Matthew Wall (weewx) <mwall@users.sourceforge.net> Tue, 07 Jul 2015 11:49:42 -0400
|
||||
weewx (3.2.0a4-1) unstable; urgency=low
|
||||
* new upstream release
|
||||
-- Matthew Wall (weewx) <mwall@users.sourceforge.net> Sun, 05 Jul 2015 21:51:41 -0400
|
||||
weewx (3.2.0a1-1) unstable; urgency=low
|
||||
* new upstream release
|
||||
* use unified wee_X utilities
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
##############################################################################
|
||||
|
||||
|
||||
Reference in New Issue
Block a user