weather: move to python3
This commit is contained in:
parent
14229cea61
commit
2d41382e7c
|
@ -0,0 +1,75 @@
|
||||||
|
From 2a84a53f4aac0175f75b77e3a73d5a68b6e20ac6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeremy Stanley <fungi@yuggoth.org>
|
||||||
|
Date: Fri, 10 Mar 2017 15:13:31 +0000
|
||||||
|
Subject: [PATCH] Fix Py3K compatibility for compressed correlation
|
||||||
|
|
||||||
|
When run under Python 3.x, explicitly decode decompressed
|
||||||
|
bytestreams if reading pre-compressed correlation data files.
|
||||||
|
---
|
||||||
|
weather.py | 24 +++++++++++++++++++-----
|
||||||
|
1 file changed, 19 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/weather.py b/weather.py
|
||||||
|
index b5b71a1..af43de4 100644
|
||||||
|
--- weather.py
|
||||||
|
+++ weather.py
|
||||||
|
@@ -744,7 +744,10 @@ def guess(
|
||||||
|
datafile = datafiles[dataname][0]
|
||||||
|
if datafile.endswith(".gz"):
|
||||||
|
import gzip
|
||||||
|
- stations.readfp( gzip.open(datafile) )
|
||||||
|
+ if pyversion("3"):
|
||||||
|
+ stations.read_string(
|
||||||
|
+ gzip.open(datafile).read().decode("utf-8") )
|
||||||
|
+ else: stations.readfp( gzip.open(datafile) )
|
||||||
|
else:
|
||||||
|
stations.read(datafile)
|
||||||
|
else:
|
||||||
|
@@ -760,7 +763,9 @@ def guess(
|
||||||
|
datafile = datafiles[dataname][0]
|
||||||
|
if datafile.endswith(".gz"):
|
||||||
|
import gzip
|
||||||
|
- zones.readfp( gzip.open(datafile) )
|
||||||
|
+ if pyversion("3"):
|
||||||
|
+ zones.read_string( gzip.open(datafile).read().decode("utf-8") )
|
||||||
|
+ else: zones.readfp( gzip.open(datafile) )
|
||||||
|
else:
|
||||||
|
zones.read(datafile)
|
||||||
|
else:
|
||||||
|
@@ -784,7 +789,10 @@ def guess(
|
||||||
|
datafile = datafiles[dataname][0]
|
||||||
|
if datafile.endswith(".gz"):
|
||||||
|
import gzip
|
||||||
|
- airports.readfp( gzip.open(datafile) )
|
||||||
|
+ if pyversion("3"):
|
||||||
|
+ airports.read_string(
|
||||||
|
+ gzip.open(datafile).read().decode("utf-8") )
|
||||||
|
+ else: airports.readfp( gzip.open(datafile) )
|
||||||
|
else:
|
||||||
|
airports.read(datafile)
|
||||||
|
else:
|
||||||
|
@@ -870,7 +878,10 @@ def guess(
|
||||||
|
datafile = datafiles[dataname][0]
|
||||||
|
if datafile.endswith(".gz"):
|
||||||
|
import gzip
|
||||||
|
- zctas.readfp( gzip.open(datafile) )
|
||||||
|
+ if pyversion("3"):
|
||||||
|
+ zctas.read_string(
|
||||||
|
+ gzip.open(datafile).read().decode("utf-8") )
|
||||||
|
+ else: zctas.readfp( gzip.open(datafile) )
|
||||||
|
else:
|
||||||
|
zctas.read(datafile)
|
||||||
|
else:
|
||||||
|
@@ -925,7 +936,10 @@ def guess(
|
||||||
|
datafile = datafiles[dataname][0]
|
||||||
|
if datafile.endswith(".gz"):
|
||||||
|
import gzip
|
||||||
|
- places.readfp( gzip.open(datafile) )
|
||||||
|
+ if pyversion("3"):
|
||||||
|
+ places.read_string(
|
||||||
|
+ gzip.open(datafile).read().decode("utf-8") )
|
||||||
|
+ else: places.readfp( gzip.open(datafile) )
|
||||||
|
else:
|
||||||
|
places.read(datafile)
|
||||||
|
else:
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
From 1ec2848c205249420d64d7924f2ee1840efff140 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeremy Stanley <fungi@yuggoth.org>
|
||||||
|
Date: Sat, 16 Sep 2017 15:47:03 +0000
|
||||||
|
Subject: [PATCH] Add FAQ entry about --headers values
|
||||||
|
|
||||||
|
Be as clear as possible about what the --headers command-line option
|
||||||
|
or headers configuration option does, and what sorts of values are
|
||||||
|
valid for it.
|
||||||
|
---
|
||||||
|
FAQ | 24 +++++++++++++++++++++++-
|
||||||
|
1 file changed, 23 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/FAQ b/FAQ
|
||||||
|
index 1e0ff03..280c0af 100644
|
||||||
|
--- FAQ
|
||||||
|
+++ FAQ
|
||||||
|
@@ -2,7 +2,7 @@
|
||||||
|
Frequently Asked Questions About the Weather Utility
|
||||||
|
======================================================
|
||||||
|
|
||||||
|
-:Copyright: (c) 2006-2012 Jeremy Stanley <fungi@yuggoth.org>. Permission
|
||||||
|
+:Copyright: (c) 2006-2017 Jeremy Stanley <fungi@yuggoth.org>. Permission
|
||||||
|
to use, copy, modify, and distribute this software is
|
||||||
|
granted under terms provided in the LICENSE file distributed
|
||||||
|
with this software.
|
||||||
|
@@ -54,3 +54,25 @@ As of the 2.0 release, this question is no longer relevant.
|
||||||
|
---------------------------------------------------------------
|
||||||
|
As of the 2.0 release, this is no longer necessary. See FAQ entries #2
|
||||||
|
and #3 for more detail.
|
||||||
|
+
|
||||||
|
+7. What values are valid for a --headers list?
|
||||||
|
+----------------------------------------------
|
||||||
|
+The default set it uses if you don't override it yourself on the command
|
||||||
|
+line or in configuration is as follows::
|
||||||
|
+
|
||||||
|
+ heat_index
|
||||||
|
+ precipitation_last_hour
|
||||||
|
+ relative_humidity
|
||||||
|
+ sky_conditions
|
||||||
|
+ temperature
|
||||||
|
+ weather
|
||||||
|
+ wind
|
||||||
|
+ windchill
|
||||||
|
+
|
||||||
|
+These are a case-insensitive match against the start of lines in a
|
||||||
|
+decoded METAR up to the first colon (:) with underscores (_) replaced by
|
||||||
|
+spaces. You can see the full METAR for a given condition report by
|
||||||
|
+passing --verbose or by observing one directly (perhaps by looking in
|
||||||
|
+your *datacache* directory). Unfortunately I haven't found any proper
|
||||||
|
+specification for the decoded METAR format used by the NWS so know of no
|
||||||
|
+comprehensive list of what lines might appear.
|
|
@ -1,12 +1,12 @@
|
||||||
# Template file for 'weather'
|
# Template file for 'weather'
|
||||||
pkgname=weather
|
pkgname=weather
|
||||||
version=2.3
|
version=2.3
|
||||||
revision=1
|
revision=2
|
||||||
noarch=yes
|
noarch=yes
|
||||||
hostmakedepends="python-devel"
|
hostmakedepends="python3"
|
||||||
makedepends="python-devel"
|
depends="python3"
|
||||||
depends="python"
|
|
||||||
pycompile_module="weather.py"
|
pycompile_module="weather.py"
|
||||||
|
conf_files="/etc/weatherrc"
|
||||||
short_desc="A CLI utility for current (METAR) weather conditions and forecasts"
|
short_desc="A CLI utility for current (METAR) weather conditions and forecasts"
|
||||||
maintainer="Richard Taityr <dicktyr@yahoo.co.uk>"
|
maintainer="Richard Taityr <dicktyr@yahoo.co.uk>"
|
||||||
license="ISC"
|
license="ISC"
|
||||||
|
@ -16,8 +16,7 @@ checksum=86148d2f1d59867f637f52558cc2a6b3280fac94df55c6e5af0ce37cc190d146
|
||||||
|
|
||||||
do_install() {
|
do_install() {
|
||||||
vbin weather
|
vbin weather
|
||||||
# note: upstream supports both python2 and python3
|
vinstall weather.py 644 "${py3_sitelib}"
|
||||||
vinstall weather.py 644 usr/lib/python2.7/site-packages
|
|
||||||
|
|
||||||
# correlation sets
|
# correlation sets
|
||||||
vmkdir usr/share/weather
|
vmkdir usr/share/weather
|
||||||
|
@ -35,6 +34,9 @@ do_install() {
|
||||||
vman weather.1
|
vman weather.1
|
||||||
vman weatherrc.5
|
vman weatherrc.5
|
||||||
|
|
||||||
|
for f in FAQ README NEWS; do
|
||||||
|
vdoc "$f"
|
||||||
|
done
|
||||||
|
|
||||||
vlicense LICENSE
|
vlicense LICENSE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue