Merge branch 'master' into python3

This commit is contained in:
Tom Keffer
2019-02-11 12:46:23 -08:00
14 changed files with 58 additions and 130 deletions

View File

@@ -1081,104 +1081,6 @@ def update_units(config_dict, unit_system_name, logger=None, debug=False):
weeutil.config.merge_config(config_dict, unit_dict)
# def patch_skins(config_dict, logger=None):
# """Update the skin configuration files to V3.9"""
#
# if 'StdReport' not in config_dict:
# return
#
# for report in config_dict['StdReport'].sections:
# patch_skin(config_dict, report, logger)
#
#
# def patch_skin(config_dict, report, logger=None):
# """Patch the given skin configuration file (skin.conf) to V3.9"""
#
# logger = logger or Logger()
#
# # Find the skin.conf file for this report
# skin_file = os.path.join(
# config_dict['WEEWX_ROOT'],
# config_dict['StdReport']['SKIN_ROOT'],
# config_dict['StdReport'][report].get('skin', ''),
# 'skin.conf')
# try:
# # Load it
# skin_dict = configobj.ConfigObj(skin_file, file_error=True)
# except IOError:
# # It's OK for the skin.conf file not to exist.
# return
#
# logger.log("Patching report %s configuration file %s" % (report, skin_file), level=2)
# patch_skin_dict(config_dict, skin_dict, report, logger)
#
# # Now write the patched skin configuration file, with a backup.
# save_with_backup(skin_dict, skin_file)
# logger.log("Finished patching report %s" % report, level=2)
#
#
# def patch_skin_dict(config_dict, skin_dict, report, logger):
# """Patch a skin configuration dictionary to V3.9"""
#
# # No need to do anything if this skin has already been upgraded
# if to_int(skin_dict.get('skin_semantics', 1)) >= 2:
# logger.log("Report %s already at level 2. Skipping" % report, level=2)
# return
#
# n_commented = 0
#
# # For each override section in the report, comment out any scalars
# # in the skin.conf file with matching names.
# for section in config_dict['StdReport'][report].sections:
# if section in skin_dict:
# n_commented += fix_overrides(config_dict['StdReport'][report][section], skin_dict[section])
#
# # For each section under [Defaults], delete any scalar in skin.conf
# # that has the same value as in [Defaults].
# for section in config_dict['Defaults'].sections:
# if section in skin_dict:
# n_commented += fix_defaults(config_dict['Defaults'][section], skin_dict[section])
#
# logger.log("For report '%s', %d lines were commented out" % (report, n_commented), level=2)
#
# # Indicate that this skin.conf file has now been patched to v2 semantics
# skin_dict['skin_semantics'] = 2
#
#
#
# def fix_overrides(section_dict, skin_dict_section):
# """Comment out any scalars in the skin configuration file that have
# been overridden in weewx.conf.
#
# Returns: The number of scalars that were commented out.
# """
#
# n_commented = 0
# # Recursively fix any overrides in any subsections under me
# for section in section_dict.sections:
# if section in skin_dict_section:
# n_commented += fix_overrides(section_dict[section], skin_dict_section[section])
# # Now comment out any overridden scalars in the skin configuration file
# for scalar in section_dict.scalars:
# n_commented += weeutil.config.comment_scalar(skin_dict_section, scalar)
#
# return n_commented
#
#
# def fix_defaults(defaults_dict, skin_dict_section):
# """Delete any values in the skin.conf that are the same as their corresponding value
# in [Defaults]"""
# n_commented = 0
# for section in defaults_dict.sections:
# if section in skin_dict_section:
# n_commented += fix_defaults(defaults_dict[section], skin_dict_section[section])
# for scalar in defaults_dict.scalars:
# if scalar in skin_dict_section and defaults_dict[scalar] == skin_dict_section[scalar]:
# n_commented += weeutil.config.comment_scalar(skin_dict_section, scalar)
#
# return n_commented
# ==============================================================================
# Utilities that extract from ConfigObj objects
# ==============================================================================

View File

@@ -191,7 +191,7 @@ class CC3000Configurator(weewx.drivers.AbstractConfigurator):
if options.current:
print self.driver.get_current()
elif options.nrecords is not None:
for r in self.driver.station.gen_records(nrecords):
for r in self.driver.station.gen_records(options.nrecords):
print r
elif options.clear:
self.clear_memory(prompt)

View File

@@ -13,6 +13,9 @@ as an alternative.
Wunderfixer now keeps going if a post does not satisfy [[Essentials]].
Fixes issue #329 (again).
Fixed problem that prevented the wee_device --history option from
working with the CC3000 driver.
3.9.1 02/06/2019

View File

@@ -240,6 +240,7 @@ rpm-package: $(DSTDIR)/$(SRCPKG)
mkdir -p -m 0755 $(RPMBLDDIR)/SPECS
mkdir -p -m 0755 $(RPMBLDDIR)/SRPMS
sed -e 's%Version:.*%Version: $(VERSION)%' \
-e 's%RPMREVISION%$(RPMREVISION)%' \
pkg/weewx.spec.in > $(RPMBLDDIR)/SPECS/weewx.spec
cat pkg/changelog.rpm >> $(RPMBLDDIR)/SPECS/weewx.spec
cp dist/weewx-$(VERSION).tar.gz $(RPMBLDDIR)/SOURCES

View File

@@ -1,3 +1,5 @@
* Wed Feb 06 2019 Matthew Wall (weewx) <mwall@users.sourceforge.net> - 3.9.1-2
- fix html_root location for suse
* Wed Feb 06 2019 Matthew Wall (weewx) <mwall@users.sourceforge.net> - 3.9.1-1
- new upstream release
* Tue Feb 05 2019 Matthew Wall (weewx) <mwall@users.sourceforge.net> - 3.9.0-1

View File

@@ -197,7 +197,7 @@ merge_weewxconf() {
# get the version number from the specified file, without the debian revisions
get_conf_version() {
echo `grep version $1 | sed -e 's/\s*version\s*=\s*//' | sed -e 's/-.*//'`
echo `grep '^version.*=' $1 | sed -e 's/\s*version\s*=\s*//' | sed -e 's/-.*//'`
}
case "$1" in

View File

@@ -51,7 +51,7 @@ install: build
cat $(SRC)/weewx.conf | sed \
-e 's%^WEEWX_ROOT =.*%WEEWX_ROOT = /%' \
-e 's%SKIN_ROOT =.*%SKIN_ROOT = /etc/weewx/skins%' \
-e 's%HTML_ROOT =.*%HTML_ROOT = /var/www/html/weewx%' \
-e 's%HTML_ROOT = public_html%HTML_ROOT = /var/www/html/weewx%' \
-e 's%SQLITE_ROOT = .*%SQLITE_ROOT = /var/lib/weewx%' \
> $(DST_CFGDIR)/weewx.conf
cat $(SRC)/util/init.d/weewx.debian | sed \

View File

@@ -4,31 +4,36 @@
# suse
%if 0%{?suse_version}
#%define relos .suse%{suse_version}
#define relos .suse%{suse_version}
%define relos .suse
%define platform suse
%define initdir /etc/init.d
%define initdir /etc/systemd/system
#define initdir /etc/init.d
%define deps , python-pyserial, python-usb
%define html_root /srv/www/htdocs/weewx
%endif
%if 0%{?sles_version}
#%define relos .sles%{sles_version}
#define relos .sles%{sles_version}
%define relos .sles
%define platform suse
%define initdir /etc/init.d
%define initdir /etc/systemd/system
#define initdir /etc/init.d
%define deps , python-pyserial, python-usb
%define html_root /srv/www/htdocs/weewx
%endif
# redhat, fedora, centos
%if "%{_vendor}" == "redhat"
#%define relos %{?dist:%{dist}}
#define relos %{?dist:%{dist}}
%define relos .rhel
%define platform redhat
%define initdir %{_initrddir}
# on redhat, must install serial and/or usb using easy_install or pip
%define deps , python-setuptools
%define html_root /var/www/html/weewx
%endif
%global relnum 1
%global relnum RPMREVISION
%global release %{relnum}%{?relos:%{relos}}
%global dst_bin_dir %{_datadir}/%{name}
@@ -84,14 +89,19 @@ cp -r util/udev %{buildroot}%{dst_cfg_dir}
cat weewx.conf | sed \
-e 's%^WEEWX_ROOT =.*%WEEWX_ROOT = /%' \
-e 's%SKIN_ROOT =.*%SKIN_ROOT = /etc/weewx/skins%' \
-e 's%HTML_ROOT =.*%HTML_ROOT = /var/www/html/weewx%' \
-e 's:HTML_ROOT = public_html:HTML_ROOT = %{html_root}:' \
-e 's%SQLITE_ROOT = .*%SQLITE_ROOT = /var/lib/weewx%' \
> %{buildroot}%{dst_cfg_dir}/weewx.conf
%if "%{initdir}" == "/etc/systemd/system"
cat util/systemd/weewx.service | sed \
-e 's%ExecStart=.*%ExecStart=/usr/bin/weewxd --daemon --pidfile=/var/run/weewx.pid /etc/weewx/weewx.conf%' \
> %{buildroot}%{initdir}/weewx.service
%else
cat util/init.d/weewx.%{platform} | sed \
-e 's%WEEWX_BIN=.*%WEEWX_BIN=/usr/bin/weewxd%' \
-e 's%WEEWX_CFG=.*%WEEWX_CFG=/etc/weewx/weewx.conf%' \
> %{buildroot}%{initdir}/weewx
chmod 755 %{buildroot}%{initdir}/weewx
%endif
# make a copy of the generic-for-this-platform configuration file
cp %{buildroot}%{dst_cfg_dir}/weewx.conf %{buildroot}%{dst_cfg_dir}/weewx.conf.dist
@@ -125,8 +135,13 @@ if [ "$1" = "1" ]; then
# this is a new installation
# 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
if [ -f /etc/systemd/system/weewx.service ]; then
systemctl enable weewx
systemctl start weewx
else
chkconfig weewx on
%{initdir}/weewx start
fi
elif [ "$1" = "2" ]; then
# this is an upgrade
# update previous config and merge with dist into to weewx.conf
@@ -138,15 +153,25 @@ elif [ "$1" = "2" ]; then
/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
%{initdir}/weewx start
if [ -f /etc/systemd/system/weewx.service ]; then
systemctl stop weewx
systemctl start weewx
else
%{initdir}/weewx stop
%{initdir}/weewx start
fi
fi
%preun
if [ "$1" = "0" ]; then
# this is an uninstall, so stop and remove everything
%{initdir}/weewx stop
chkconfig weewx off
if [ -f /etc/systemd/system/weewx.service ]; then
systemctl stop weewx
systemctl disable weewx
else
%{initdir}/weewx stop
chkconfig weewx off
fi
fi
# otherwise this is an upgrade (1), so do nothing
@@ -155,7 +180,11 @@ rm -rf %{buildroot}
%files
%defattr(-,root,root)
%attr(755,root,root) %{initdir}/weewx
%if "%{initdir}" == "/etc/systemd/system"
%{initdir}/weewx.service
%else
%attr(755,root,root) %{initdir}/weewx
%endif
%{dst_bin_dir}/
%{_bindir}/weewxd
%{_bindir}/wee_config

View File

@@ -6,8 +6,6 @@
# engine to invoke FTP, which copies files to another location. #
###############################################################################
skin_semantics = 2
[Generators]
generator_list = weewx.reportengine.FtpGenerator

View File

@@ -1,7 +1,5 @@
# configuration file for Mobile skin
skin_semantics = 2
[Extras]
# Set this URL to display a radar image
#radar_img = http://radar.weather.gov/ridge/lite/N0R/RTX_loop.gif

View File

@@ -7,8 +7,6 @@
# engine to invoke rsync, which synchronizes files between two locations. #
###############################################################################
skin_semantics = 2
[Generators]
generator_list = weewx.reportengine.RsyncGenerator

View File

@@ -4,11 +4,11 @@
# See the file LICENSE.txt for your rights. #
###############################################################################
skin_semantics = 2
###############################################################################
# The following section is for any extra tags that you want to be available in the templates
# The following section is for any extra tags that you want to be available in
# the templates
[Extras]
# This radar image would be available as $Extras.radar_img
@@ -84,7 +84,8 @@ skin_semantics = 2
template = tabular.html.tmpl
[[[celestial]]]
template = celestial.html.tmpl
# Uncomment the following to have WeeWX generate a celestial page only once an hour:
# Uncomment the following to generate a celestial page only once
# an hour instead of every report cycle.
# stale_age = 3600
[[[RSS]]]
template = rss.xml.tmpl

View File

@@ -1,7 +1,5 @@
# configuration file for Smartphone skin
skin_semantics = 2
[Extras]
# Set this URL to display a radar image
#radar_img = http://radar.weather.gov/ridge/lite/N0R/RTX_loop.gif

View File

@@ -4,8 +4,6 @@
# See the file LICENSE.txt for your rights. #
###############################################################################
skin_semantics = 2
###############################################################################
# The following section is for any extra tags that you want to be available in the templates