mirror of
https://github.com/weewx/weewx.git
synced 2026-04-21 18:17:01 -04:00
Made the install process more robust to upgrading FTP and Wunderground
This commit is contained in:
10
CHANGES.txt
10
CHANGES.txt
@@ -8,6 +8,16 @@ now does a better job for ranges less than 1.0. The user can also
|
||||
hardwire in min and max values, as well as specify a minimum increment, through
|
||||
parameter 'yscale' in section [Images] in the configuration file.
|
||||
|
||||
Rain year is now parameterized in file templates/year.tmpl (instead of
|
||||
being hardwired in).
|
||||
|
||||
Now does LOOP caching by default.
|
||||
|
||||
When doing backfilling to the stats database, configure now creates the stats
|
||||
database if it doesn't already exist.
|
||||
|
||||
setup.py now more robust to upgrading the FTP and Wunderground sections
|
||||
|
||||
|
||||
1.1.0 11/14/09
|
||||
|
||||
|
||||
25
readme.htm
25
readme.htm
@@ -529,16 +529,6 @@ year starts in October (as mine does). Default is 1.</p>
|
||||
<h4 class="config_important">radar_url</h4>
|
||||
<p>This variable is available in the HTML templates. Set it to an appropriate URL
|
||||
to display a radar image for your area. No default.</p>
|
||||
<h4 class="config_important">cache_loop_data</h4>
|
||||
<p>Set to 1 (one) to cache LOOP data, otherwise, set to zero. By default,
|
||||
<span class="code">weewx </span>updates the statistical database with every LOOP
|
||||
update. This can be as often as every two seconds. If you are using a solid-state
|
||||
disk as your permanent store, this can result in a lot of wear on the device. By
|
||||
setting <span class="code">cache_loop_data </span>to 1, the LOOP data will be cached,
|
||||
and the stats database will be updated only when new archive data is due. This results
|
||||
in many fewer writes to the database, but possible loss of data should your server
|
||||
go down between archive updates. (The only data actually lost would be any new High/Lows
|
||||
found during the archive period.) The default is 0 (no caching).</p>
|
||||
<h4 class="config_option">heating_base<br />
|
||||
cooling_base</h4>
|
||||
<p>Set to the base temperature for calculating heating and cooling degree-days,
|
||||
@@ -546,6 +536,10 @@ respectively. The default is 65.0 for both.</p>
|
||||
<h4 class="config_option">hemispheres</h4>
|
||||
<p>Set to suitable abbreviations for the four hemispheres. Default is "N", "S",
|
||||
"E", "W"</p>
|
||||
<h4 class="config_option">cache_loop_data</h4>
|
||||
<p>Set to 1 (one) to cache LOOP data, otherwise, set to zero. Most users will
|
||||
not want to change this unless you have a specialized application. Default is 1
|
||||
(cache LOOP data).</p>
|
||||
<h4 class="config_option">station_type</h4>
|
||||
<p>Set to the type of hardware you are using. For this version, only '<span class="code">VantagePro</span>'
|
||||
is accepted. Required.</p>
|
||||
@@ -598,8 +592,7 @@ only Imperial. In any case, Imperial is the only system supported by
|
||||
<span class="code">weewx</span> can FTP them for you. It does an incremental update,
|
||||
that is, it only FTPs any files that have changed, saving outgoing bandwidth with
|
||||
your Internet connection.</p>
|
||||
<p>If you do not use such a server, comment out the entire section, including the
|
||||
'<span class="code">[FTP]</span>' heading.</p>
|
||||
<p>If you do not use such a server, comment out the first four options below.</p>
|
||||
<p class="config_important">user</p>
|
||||
<p>Set to the username you use for your FTP connection to your web server. Required.
|
||||
No default.</p>
|
||||
@@ -611,7 +604,8 @@ No default.</p>
|
||||
www.threefools.org</a>, in my case). Required. No default</p>
|
||||
<p class="config_important">path</p>
|
||||
<p>Set to the path where the weather data will be stored on your webserver (e.g.,
|
||||
'<span class="code">weather</span>'). Required. No default.</p>
|
||||
'<span class="code">/weather</span>'). NB: some FTP servers require a
|
||||
leading slash ('<span class="code">/</span>'), some don't. Required. No default.</p>
|
||||
<h4 class="config_important">passive</h4>
|
||||
<p>Set to 1 if you wish to use the more modern, FTP passive mode, 0 if you wish
|
||||
to use active mode. Passive mode generally works better through firewalls, but not
|
||||
@@ -623,9 +617,8 @@ mode).</p>
|
||||
<p><span class="code">Weewx</span> will try up to this many times to FTP a file
|
||||
up to your server before giving up. Default is 3.</p>
|
||||
<h3 class="config_section">[Wunderground]</h3>
|
||||
<p><span class="code">Weewx </span>can send your current data to the Weather Underground.
|
||||
If you do not wish to do this, comment out the entire section, including the '<span class="code">[Wunderground]</span>'
|
||||
heading.</p>
|
||||
<p><span class="code">Weewx </span>can send your current data to the Weather
|
||||
Underground. If you do not wish to do this, comment out the two options below.</p>
|
||||
<h4 class="config_option"><span class="config_important">station</span></h4>
|
||||
<p>Set to your Weather Underground station ID (e.g., <span class="code">KORHOODR3</span>).
|
||||
Required.</p>
|
||||
|
||||
44
setup.py
44
setup.py
@@ -26,8 +26,8 @@
|
||||
In addition to the normal setup script duties, this script does the
|
||||
following:
|
||||
|
||||
1. When building a source distribution ('sdist') it filters out username
|
||||
and password information from the configuration file weewx.conf
|
||||
1. When building a source distribution ('sdist') it checks for
|
||||
password information in the configuration file weewx.conf
|
||||
|
||||
2. It merges any existing weewx.conf configuration files into the new, thus
|
||||
preserving any user changes.
|
||||
@@ -43,6 +43,8 @@ from distutils.core import setup, Command
|
||||
from distutils.command.install_data import install_data
|
||||
from distutils.command.sdist import sdist
|
||||
from distutils import log
|
||||
|
||||
import sys
|
||||
import os
|
||||
import os.path
|
||||
import re
|
||||
@@ -159,7 +161,7 @@ def backup(filepath):
|
||||
return newpath
|
||||
|
||||
class My_sdist(sdist):
|
||||
"""Specialized version of sdist which does not include password information in distribution
|
||||
"""Specialized version of sdist which checks for password information in distribution
|
||||
|
||||
See http://epydoc.sourceforge.net/stdlib/distutils.command.sdist.sdist-class.html
|
||||
for possible sdist instance methods."""
|
||||
@@ -173,32 +175,18 @@ class My_sdist(sdist):
|
||||
# If this is the configuration file, then massage it to eliminate
|
||||
# the password info
|
||||
if f == 'weewx.conf':
|
||||
# Should have a more useful logging message than this!
|
||||
# If we're working with the configuration file, make sure it doesn't
|
||||
# have any private data in it.
|
||||
config = configobj.ConfigObj(f)
|
||||
config.indent_type = ' '
|
||||
try:
|
||||
config['FTP']['user'] = """replace with your username"""
|
||||
config['FTP']['password'] = """replace with your password"""
|
||||
config['FTP']['server'] = """replace with your server name, eg, www.threefools.org"""
|
||||
config['FTP']['path'] = """replace with the destination root directory on your server"""
|
||||
print config['FTP']['user']
|
||||
print config['FTP']['password']
|
||||
print config['FTP']['server']
|
||||
log.info("%s %s -> %s", 'filtering', f, install_dir)
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
config['Wunderground']['station'] = " (replace with your Weather Underground station name)"
|
||||
config['Wunderground']['password'] = "(replace with your password)"
|
||||
except KeyError:
|
||||
pass
|
||||
if not self.dry_run:
|
||||
outfile = open(install_dir, 'w')
|
||||
config.write(outfile)
|
||||
outfile.close()
|
||||
return (install_dir, True)
|
||||
else :
|
||||
return sdist.copy_file(self, f, install_dir, **kwargs)
|
||||
|
||||
if config.has_key('FTP') and config['FTP'].has_key('password'):
|
||||
sys.stderr.write("\n*** FTP password found in configuration file. Aborting ***\n\n")
|
||||
exit()
|
||||
|
||||
if config.has_key('Wunderground') and config['Wunderground'].has_key('password'):
|
||||
sys.stderr.write("\n*** Wunderground password found in configuration file. Aborting ***\n\n")
|
||||
exit()
|
||||
return sdist.copy_file(self, f, install_dir, **kwargs)
|
||||
|
||||
setup(name='weewx',
|
||||
version=VERSION,
|
||||
|
||||
33
weewx.conf
33
weewx.conf
@@ -46,11 +46,6 @@ socket_timeout = 20
|
||||
rain_year_start = 10
|
||||
radar_url = http://radar.weather.gov/ridge/lite/N0R/RTX_loop.gif
|
||||
|
||||
# Set to 1 (one) to cache LOOP data, otherwise zero. You may
|
||||
# want to do this if you are using a solid-state disk for your archive,
|
||||
# as caching the LOOP data will dramatically reduce the number of writes.
|
||||
cache_loop_data = 0
|
||||
|
||||
# Base temperature for heating days:
|
||||
heating_base = 65
|
||||
# Base temperature for cooling days:
|
||||
@@ -59,6 +54,10 @@ socket_timeout = 20
|
||||
# Set to hemisphere abbreviations suitable for your location:
|
||||
hemispheres = N, S, E, W
|
||||
|
||||
# Set to 1 (one) to cache LOOP data, otherwise zero. Most people
|
||||
# will want to set this to one unless you have a specialized application
|
||||
cache_loop_data = 1
|
||||
|
||||
# Set to type of station (e.g., 'VantagePro' for a Davis VantagePro or VantagePro2)
|
||||
# Must match section name below.
|
||||
station_type = VantagePro
|
||||
@@ -115,38 +114,34 @@ socket_timeout = 20
|
||||
|
||||
############################################################################################
|
||||
|
||||
#[FTP]
|
||||
[FTP]
|
||||
|
||||
#
|
||||
# This section is for configuring FTP uploads to a remote web server.
|
||||
#
|
||||
# Comment the whole section out, including the sub-section header '[FTP]'
|
||||
# above, if you don't want / need to do this.
|
||||
#
|
||||
|
||||
# If you wish to do this, make sure the following four lines are uncommented
|
||||
# and filled out somewhere in this section:
|
||||
# user = replace with your username
|
||||
# password = replace with your password
|
||||
# server = "replace with your server name, eg, www.threefools.org"
|
||||
# path = replace with the destination root directory on your server
|
||||
# server = replace with your server name, e.g, www.threefools.org
|
||||
# path = replace with the destination root directory on your server (e.g., '/weather)
|
||||
|
||||
# Set to 1 to use passive mode, zero for active mode:
|
||||
# passive = 1
|
||||
passive = 1
|
||||
|
||||
# How many times to try to transfer a file before giving up:
|
||||
# max_retries = 3
|
||||
max_retries = 3
|
||||
|
||||
############################################################################################
|
||||
|
||||
#[Wunderground]
|
||||
[Wunderground]
|
||||
|
||||
#
|
||||
# This section is for configuring data transfer to your Weather Underground
|
||||
# station.
|
||||
#
|
||||
# Comment the whole section out, including the sub-section header
|
||||
# '[Wunderground]' above, if you don't want / need to do this.
|
||||
#
|
||||
|
||||
# If you wish to do this, make sure the following two lines are uncommented
|
||||
# and filled out somewhere in this section.
|
||||
|
||||
# station = your Weather Underground station ID here (eg, KORHOODR3)
|
||||
# password = your password here
|
||||
|
||||
Reference in New Issue
Block a user