new upstream release - 2.17

This commit is contained in:
Kamil Dudka 2018-06-26 10:02:47 +02:00
parent c8f18391dd
commit e31a3f5652
5 changed files with 7 additions and 86 deletions

View File

@ -1,80 +0,0 @@
From 29b4b1ac90bfe54f1d7d83a3b3e4e1a1305332fa Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Mon, 28 May 2018 14:21:35 +0200
Subject: [PATCH] Resolves: #1574835 - make units_cur work again
---
units_cur | 44 ++++++++++++++++++++++++++------------------
1 file changed, 26 insertions(+), 18 deletions(-)
diff --git a/units_cur b/units_cur
index 5541355..d00c12c 100755
--- a/units_cur
+++ b/units_cur
@@ -5,14 +5,17 @@ from __future__ import absolute_import, division, print_function
#
#
-version = '4.1'
+version = '4.2'
-# 30 October 2017
+# Version 4.2: 18 April 2018
+#
+# Handle case of empty/malformed entry returned from the server
+#
+# Version 4.1: 30 October 2017
#
# Fixed to include USD in the list of currency codes.
#
-# Version 4
-# 2 October 2017
+# Version 4: 2 October 2017
#
# Complete rewrite to use Yahoo YQL API due to removal of TimeGenie RSS feed.
# Switched to requests library using JSON. One program now runs under
@@ -258,22 +261,27 @@ except requests.exceptions.RequestException as e:
format(e))
exit(1)
-rates = [ data['resource']['fields']['price'] for data in webdata]
-codes = [ data['resource']['fields']['symbol'][0:3] for data in webdata]
rate_index = 1
-
-for (code,rate) in zip(codes,rates):
- if code not in currency.keys():
- if (verbose):
- stderr.write('Got unknown currency with code {}\n'.format(code))
- else:
- if not currency[code][rate_index]:
- currency[code][rate_index] = '1|{} US$'.format(rate)
- elif verbose:
- stderr.write('Got value "{}" for currency "{}" but '
- 'it is already defined\n'.format(rate, code))
-
+for data in webdata:
+ entry = data['resource']['fields']
+ if 'price' not in entry or 'symbol' not in entry: # Skip empty/bad entries
+ if verbose:
+ stderr.write('Got bad entry from server: '+str(entry)+'\n')
+ else:
+ rate = entry['price']
+ code = entry['symbol'][0:3]
+ if code not in currency.keys():
+ if (verbose):
+ stderr.write('Got unknown currency with code {}\n'.format(code))
+ else:
+ if not currency[code][rate_index]:
+ currency[code][rate_index] = '1|{} US$'.format(rate)
+ elif verbose:
+ stderr.write('Got value "{}" for currency "{}" but '
+ 'it is already defined\n'.format(rate, code))
+
+
# Delete currencies where we have no rate data
for code in currency.keys():
if not currency[code][rate_index]:
--
2.14.3

View File

@ -1 +1 @@
SHA512 (units-2.16.tar.gz) = afca2bf313208db2d0a3f4e96fed7bb86a3e96030b420e1cfa68a140499b9a8f2ef8c166c1d608d03c9ca6260199569a67c67c623d8c6a4b8d52e9d5cb6e3091 SHA512 (units-2.17.tar.gz) = e4114f7dc0e40146f969375511c5d930497cb9502306ef82feac78c8e09a03e84ed0b582ff82e2878beae41702c9612f7a3d28fc6e9ed2cfae708f9feb8b737b

Binary file not shown.

BIN
units-2.17.tar.gz.sig Normal file

Binary file not shown.

View File

@ -1,7 +1,7 @@
Summary: A utility for converting amounts from one unit to another Summary: A utility for converting amounts from one unit to another
Name: units Name: units
Version: 2.16 Version: 2.17
Release: 5%{?dist} Release: 1%{?dist}
Source: https://ftp.gnu.org/gnu/units/%{name}-%{version}.tar.gz Source: https://ftp.gnu.org/gnu/units/%{name}-%{version}.tar.gz
URL: https://www.gnu.org/software/units/units.html URL: https://www.gnu.org/software/units/units.html
License: GPLv3+ License: GPLv3+
@ -17,9 +17,6 @@ BuildRequires: readline-devel
# used by the units_cur script # used by the units_cur script
Requires: python3-unidecode Requires: python3-unidecode
# make units_cur work again (#1574835)
Patch1: 0001-units-2.16-units_cur.patch
%description %description
Units converts an amount from one unit to another, or tells you what Units converts an amount from one unit to another, or tells you what
mathematical operation you need to perform to convert from one unit to mathematical operation you need to perform to convert from one unit to
@ -63,10 +60,14 @@ fi
%{_bindir}/units %{_bindir}/units
%{_bindir}/units_cur %{_bindir}/units_cur
%{_datadir}/units %{_datadir}/units
%{_sharedstatedir}/units
%{_infodir}/* %{_infodir}/*
%{_mandir}/man1/* %{_mandir}/man1/*
%changelog %changelog
* Tue Jun 26 2018 Kamil Dudka <kdudka@redhat.com> - 2.17-1
- new upstream release
* Mon May 28 2018 Kamil Dudka <kdudka@redhat.com> - 2.16-5 * Mon May 28 2018 Kamil Dudka <kdudka@redhat.com> - 2.16-5
- make units_cur work again (#1574835) - make units_cur work again (#1574835)