Compare commits
3 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9f52bea71 | ||
|
|
2a208a8432 | ||
|
|
7a614eaadc |
4 changed files with 543 additions and 1 deletions
25
0001-units-2.14-units_cur-default-path.patch
Normal file
25
0001-units-2.14-units_cur-default-path.patch
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
From d300ba3e84ab76f9c0977ab5219072ca2350b055 Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Mon, 4 Dec 2017 12:03:01 +0100
|
||||
Subject: [PATCH] units_cur: replace default path properly
|
||||
|
||||
---
|
||||
Makefile.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 1a74852..46e2bb7 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -128,7 +128,7 @@ units_cur3: units_cur2
|
||||
rm -rf python3_tempdir
|
||||
|
||||
units_cur_inst: units_cur
|
||||
- sed -e "s@outfile = 'currency.units'@outfile='@UDAT@currency.units'@"\
|
||||
+ sed -e "s@outfile_name = 'currency.units'@outfile_name='@UDAT@currency.units'@"\
|
||||
-e "s@/usr/bin/python@$(PYTHON)@" \
|
||||
units_cur > units_cur_inst
|
||||
|
||||
--
|
||||
2.13.6
|
||||
|
||||
159
0002-units-2.15-units_cur.patch
Normal file
159
0002-units-2.15-units_cur.patch
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
From 32b280b54c0c02e2ab9c41b017363ce3c2dd855d Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Mon, 28 May 2018 14:52:21 +0200
|
||||
Subject: [PATCH 1/2] update units_cur script from units-2.16
|
||||
|
||||
---
|
||||
units_cur2 | 28 ++++++++++++++++++++++------
|
||||
1 file changed, 22 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/units_cur2 b/units_cur2
|
||||
index ec5872a..5541355 100755
|
||||
--- a/units_cur2
|
||||
+++ b/units_cur2
|
||||
@@ -1,5 +1,16 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
+# For Python 2 & 3 compatibility
|
||||
+from __future__ import absolute_import, division, print_function
|
||||
+#
|
||||
+#
|
||||
+
|
||||
+version = '4.1'
|
||||
+
|
||||
+# 30 October 2017
|
||||
+#
|
||||
+# Fixed to include USD in the list of currency codes.
|
||||
+#
|
||||
# Version 4
|
||||
# 2 October 2017
|
||||
#
|
||||
@@ -7,9 +18,6 @@
|
||||
# Switched to requests library using JSON. One program now runs under
|
||||
# Python 2 or Python 3. Thanks to Ray Hamel for some help with this update.
|
||||
|
||||
-# For Python 2 & 3 compatibility
|
||||
-from __future__ import absolute_import, division, print_function
|
||||
-
|
||||
# Normal imports
|
||||
import requests
|
||||
import codecs
|
||||
@@ -21,9 +29,10 @@ from sys import exit, stderr, stdout
|
||||
|
||||
outfile_name = 'currency.units'
|
||||
|
||||
-# The Yahoo API is excellent, but unfortunately requires we explicitly request
|
||||
-# each currency we want
|
||||
-#
|
||||
+# This exchange rate table lists the currency ISO 4217 codes, their
|
||||
+# long text names, and any fixed definitions. If the definition is
|
||||
+# empty then units_cur will query the server for a value.
|
||||
+
|
||||
currency = OrderedDict([
|
||||
('ATS', ['austriaschilling', '1|13.7603 euro']),
|
||||
('BEF', ['belgiumfranc', '1|40.3399 euro']),
|
||||
@@ -192,6 +201,7 @@ currency = OrderedDict([
|
||||
('TZS', ['tanzaniashilling','']),
|
||||
('UAH', ['ukrainehryvnia','']),
|
||||
('UGX', ['ugandaschilling','']),
|
||||
+ ('USD', ['unitedstatesdollar', 'US$']),
|
||||
('UYU', ['uruguaypeso','']),
|
||||
('UZS', ['uzbekistansum','']),
|
||||
('VEF', ['venezuelabolivar','']),
|
||||
@@ -224,6 +234,12 @@ ap.add_argument(
|
||||
type=str,
|
||||
)
|
||||
|
||||
+ap.add_argument('-V','--version',
|
||||
+ action='version',
|
||||
+ version='%(prog)s version ' + version,
|
||||
+ help='display units_cur version',
|
||||
+)
|
||||
+
|
||||
ap.add_argument('-v','--verbose',
|
||||
action='store_true',
|
||||
help='display details when fetching currency data',
|
||||
--
|
||||
2.14.3
|
||||
|
||||
|
||||
From 4e59d86aa34fa8ef95ef1f81e2720670735c910d Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Mon, 28 May 2018 14:21:35 +0200
|
||||
Subject: [PATCH 2/2] Resolves: #1574835 - make units_cur work again
|
||||
|
||||
---
|
||||
units_cur2 | 44 ++++++++++++++++++++++++++------------------
|
||||
1 file changed, 26 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/units_cur2 b/units_cur2
|
||||
index 5541355..d00c12c 100755
|
||||
--- a/units_cur2
|
||||
+++ b/units_cur2
|
||||
@@ -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
|
||||
|
||||
336
units-2.15-units_cur
Normal file
336
units-2.15-units_cur
Normal file
|
|
@ -0,0 +1,336 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# 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
|
||||
# Python 2 or Python 3. Thanks to Ray Hamel for some help with this update.
|
||||
|
||||
# For Python 2 & 3 compatibility
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
# Normal imports
|
||||
import requests
|
||||
import codecs
|
||||
from argparse import ArgumentParser
|
||||
from collections import OrderedDict
|
||||
from datetime import date
|
||||
from os import linesep
|
||||
from sys import exit, stderr, stdout
|
||||
|
||||
outfile_name = 'currency.units'
|
||||
|
||||
# The Yahoo API is excellent, but unfortunately requires we explicitly request
|
||||
# each currency we want
|
||||
#
|
||||
currency = OrderedDict([
|
||||
('ATS', ['austriaschilling', '1|13.7603 euro']),
|
||||
('BEF', ['belgiumfranc', '1|40.3399 euro']),
|
||||
('CYP', ['cypruspound', '1|0.585274 euro']),
|
||||
('EEK', ['estoniakroon', '1|15.6466 euro # Equal to 1|8 germanymark']),
|
||||
('FIM', ['finlandmarkka', '1|5.94573 euro']),
|
||||
('FRF', ['francefranc', '1|6.55957 euro']),
|
||||
('DEM', ['germanymark', '1|1.95583 euro']),
|
||||
('GRD', ['greecedrachma', '1|340.75 euro']),
|
||||
('IEP', ['irelandpunt', '1|0.787564 euro']),
|
||||
('ITL', ['italylira', '1|1936.27 euro']),
|
||||
('LVL', ['latvialats', '1|0.702804 euro']),
|
||||
('LTL', ['lithuanialitas', '1|3.4528 euro']),
|
||||
('LUF', ['luxembourgfranc', '1|40.3399 euro']),
|
||||
('MTL', ['maltalira', '1|0.4293 euro']),
|
||||
('SKK', ['slovakiakornua', '1|30.1260 euro']),
|
||||
('SIT', ['sloveniatolar', '1|239.640 euro']),
|
||||
('ESP', ['spainpeseta', '1|166.386 euro']),
|
||||
('NLG', ['netherlandsguilder','1|2.20371 euro']),
|
||||
('PTE', ['portugalescudo', '1|200.482 euro']),
|
||||
('CVE', ['capeverdeescudo', '1|110.265 euro']),
|
||||
('BGN', ['bulgarialev', '1|1.9558 euro']),
|
||||
('BAM', ['bosniaconvertiblemark','germanymark']),
|
||||
('KMF', ['comorosfranc', '1|491.96775 euro']),
|
||||
('XOF', ['westafricanfranc', '1|655.957 euro']),
|
||||
('XPF', ['cfpfranc', '1|119.33 euro']),
|
||||
('XAF', ['centralafricancfafranc','1|655.957 euro']),
|
||||
('AED', ['uaedirham','']),
|
||||
('AFN', ['afghanafghani','']),
|
||||
('ALL', ['albanialek','']),
|
||||
('AMD', ['armeniadram','']),
|
||||
('AOA', ['angolakwanza','']),
|
||||
('ARS', ['argentinapeso','']),
|
||||
('AUD', ['australiadollar','']),
|
||||
('AWG', ['arubaflorin','']),
|
||||
('AZN', ['azerbaijanmanat','']),
|
||||
('BAM', ['bosniaconvertiblemark','']),
|
||||
('BBD', ['barbadosdollar','']),
|
||||
('BDT', ['bangladeshtaka','']),
|
||||
('BGN', ['bulgarialev','']),
|
||||
('BHD', ['bahraindinar','']),
|
||||
('BIF', ['burundifranc','']),
|
||||
('BMD', ['bermudadollar','']),
|
||||
('BND', ['bruneidollar','']),
|
||||
('BOB', ['boliviaboliviano','']),
|
||||
('BRL', ['brazilreal','']),
|
||||
('BSD', ['bahamasdollar','']),
|
||||
('BTN', ['bhutanngultrum','']),
|
||||
('BWP', ['botswanapula','']),
|
||||
('BYN', ['belarusruble','']),
|
||||
('BYR', ['oldbelarusruble','10000 BYN']),
|
||||
('BZD', ['belizedollar','']),
|
||||
('CAD', ['canadadollar','']),
|
||||
('CDF', ['drcfranccongolais','']),
|
||||
('CHF', ['swissfranc','']),
|
||||
('CLP', ['chilepeso','']),
|
||||
('CNY', ['chinayuan','']),
|
||||
('COP', ['colombiapeso','']),
|
||||
('CRC', ['costaricacolon','']),
|
||||
('CUP', ['cubapeso','']),
|
||||
('CVE', ['capeverdeescudo','']),
|
||||
('CZK', ['czechkoruna','']),
|
||||
('DJF', ['djiboutifranc','']),
|
||||
('DKK', ['denmarkkrona','']),
|
||||
('DOP', ['dominicanrepublicpeso','']),
|
||||
('DZD', ['algeriadinar','']),
|
||||
('EGP', ['egyptpound','']),
|
||||
('ERN', ['eritreanakfa','']),
|
||||
('ETB', ['ethiopianbirr','']),
|
||||
('EUR', ['euro','']),
|
||||
('FJD', ['fijidollar','']),
|
||||
('FKP', ['falklandislandspound','']),
|
||||
('GBP', ['ukpound','']),
|
||||
('GEL', ['georgialari','']),
|
||||
('GHS', ['ghanacedi','']),
|
||||
('GIP', ['gibraltarpound','']),
|
||||
('GMD', ['gambiadalasi','']),
|
||||
('GNF', ['guineafranc','']),
|
||||
('GTQ', ['guatemalaquetzal','']),
|
||||
('GYD', ['guyanadollar','']),
|
||||
('HKD', ['hongkongdollar','']),
|
||||
('HNL', ['honduraslempira','']),
|
||||
('HRK', ['croatiakuna','']),
|
||||
('HTG', ['haitigourde','']),
|
||||
('HUF', ['hungariaforint','']),
|
||||
('IDR', ['indonesiarupiah','']),
|
||||
('ILS', ['israelnewshekel','']),
|
||||
('INR', ['indiarupee','']),
|
||||
('IQD', ['iraqdinar','']),
|
||||
('IRR', ['iranrial','']),
|
||||
('ISK', ['icelandkrona','']),
|
||||
('JMD', ['jamaicadollar','']),
|
||||
('JOD', ['jordandinar','']),
|
||||
('JPY', ['japanyen','']),
|
||||
('KES', ['kenyaschilling','']),
|
||||
('KGS', ['kyrgyzstansom','']),
|
||||
('KHR', ['cambodiariel','']),
|
||||
('KMF', ['comorosfranc','']),
|
||||
('KPW', ['northkoreawon','']),
|
||||
('KRW', ['southkoreawon','']),
|
||||
('KWD', ['kuwaitdinar','']),
|
||||
('KYD', ['caymanislandsdollar','']),
|
||||
('KZT', ['kazakhstantenge','']),
|
||||
('LAK', ['laokip','']),
|
||||
('LBP', ['lebanonpound','']),
|
||||
('LKR', ['srilankanrupee','']),
|
||||
('LRD', ['liberiadollar','']),
|
||||
('LTL', ['lithuanialita','']),
|
||||
('LVL', ['latvialat','']),
|
||||
('LYD', ['libyadinar','']),
|
||||
('MAD', ['moroccodirham','']),
|
||||
('MDL', ['moldovaleu','']),
|
||||
('MGA', ['madagascarariary','']),
|
||||
('MKD', ['macedoniadenar','']),
|
||||
('MMK', ['myanmarkyat','']),
|
||||
('MNT', ['mongoliatugrik','']),
|
||||
('MOP', ['macaupataca','']),
|
||||
('MRO', ['mauritaniaouguiya','']),
|
||||
('MUR', ['mauritiusrupee','']),
|
||||
('MVR', ['maldiverufiyaa','']),
|
||||
('MWK', ['malawikwacha','']),
|
||||
('MXN', ['mexicopeso','']),
|
||||
('MYR', ['malaysiaringgit','']),
|
||||
('MZN', ['mozambicanmetical','']),
|
||||
('NAD', ['namibiadollar','']),
|
||||
('NGN', ['nigerianaira','']),
|
||||
('NIO', ['nicaraguacordobaoro','']),
|
||||
('NOK', ['norwaykrone','']),
|
||||
('NPR', ['nepalrupee','']),
|
||||
('NZD', ['newzealanddollar','']),
|
||||
('OMR', ['omanrial','']),
|
||||
('PAB', ['panamabalboa','']),
|
||||
('PEN', ['perunuevosol','']),
|
||||
('PGK', ['papuanewguineakina','']),
|
||||
('PHP', ['philippinepeso','']),
|
||||
('PKR', ['pakistanrupee','']),
|
||||
('PLN', ['polandzloty','']),
|
||||
('PYG', ['paraguayguarani','']),
|
||||
('QAR', ['qatarrial','']),
|
||||
('RON', ['romanianewlei','']),
|
||||
('RSD', ['serbiadinar','']),
|
||||
('RUB', ['russiaruble','']),
|
||||
('RWF', ['rwandafranc','']),
|
||||
('SAR', ['saudiarabiariyal','']),
|
||||
('SBD', ['solomonislandsdollar','']),
|
||||
('SCR', ['seychellesrupee','']),
|
||||
('SDG', ['sudanpound','']),
|
||||
('SEK', ['swedenkrona','']),
|
||||
('SGD', ['singaporedollar','']),
|
||||
('SHP', ['sainthelenapound','']),
|
||||
('SLL', ['sierraleoneleone','']),
|
||||
('SOS', ['somaliaschilling','']),
|
||||
('SRD', ['surinamedollar','']),
|
||||
('STD', ['saotome&principedobra','']),
|
||||
('SVC', ['elsalvadorcolon','']),
|
||||
('SYP', ['syriapound','']),
|
||||
('SZL', ['swazilandlilangeni','']),
|
||||
('THB', ['thailandbaht','']),
|
||||
('TJS', ['tajikistansomoni','']),
|
||||
('TMT', ['turkmenistanmanat','']),
|
||||
('TND', ['tunisiadinar','']),
|
||||
('TOP', ["tongapa'anga",'']),
|
||||
('TRY', ['turkeylira','']),
|
||||
('TTD', ['trinidadandtobagodollar','']),
|
||||
('TWD', ['taiwandollar','']),
|
||||
('TZS', ['tanzaniashilling','']),
|
||||
('UAH', ['ukrainehryvnia','']),
|
||||
('UGX', ['ugandaschilling','']),
|
||||
('UYU', ['uruguaypeso','']),
|
||||
('UZS', ['uzbekistansum','']),
|
||||
('VEF', ['venezuelabolivar','']),
|
||||
('VEB', ['venezuelaoldbolivar', '1000 VEF']),
|
||||
('VND', ['vietnamdong','']),
|
||||
('VUV', ['vanuatuvatu','']),
|
||||
('WST', ['samoatala','']),
|
||||
('XAF', ['centralafricancfafranc','']),
|
||||
('XCD', ['eastcaribbeandollar','']),
|
||||
('XDR', ['specialdrawingrights','']),
|
||||
('YER', ['yemenrial','']),
|
||||
('ZAR', ['southafricarand','']),
|
||||
('ZMW', ['zambiakwacha','']),
|
||||
('ZWL', ['zimbabwedollar','']),
|
||||
])
|
||||
|
||||
ap = ArgumentParser(
|
||||
description="Update currency information for 'units' "
|
||||
"into the specified filename or if no filename is "
|
||||
"given, the default: '{}'. The special filename '-' "
|
||||
"will send the currency data to stdout.".format(outfile_name),
|
||||
)
|
||||
|
||||
ap.add_argument(
|
||||
'output_file',
|
||||
default=outfile_name,
|
||||
help='the file to update',
|
||||
metavar='filename',
|
||||
nargs='?',
|
||||
type=str,
|
||||
)
|
||||
|
||||
ap.add_argument('-v','--verbose',
|
||||
action='store_true',
|
||||
help='display details when fetching currency data',
|
||||
)
|
||||
|
||||
outfile_name = ap.parse_args().output_file
|
||||
verbose = ap.parse_args().verbose
|
||||
|
||||
try:
|
||||
res = requests.get('http://finance.yahoo.com/webservice/v1/symbols'
|
||||
'/allcurrencies/quote?format=json')
|
||||
res.raise_for_status()
|
||||
webdata = res.json()['list']['resources']
|
||||
except requests.exceptions.RequestException as e:
|
||||
stderr.write('Error connecting to currency server:\n{}.\n'.
|
||||
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))
|
||||
|
||||
# Delete currencies where we have no rate data
|
||||
for code in currency.keys():
|
||||
if not currency[code][rate_index]:
|
||||
if verbose:
|
||||
stderr.write('No data for {}'.format(code))
|
||||
del currency[code]
|
||||
|
||||
try:
|
||||
req = requests.get('http://services.packetizer.com/spotprices/?f=json')
|
||||
req.raise_for_status()
|
||||
metals = req.json()
|
||||
except requests.exceptions.RequestException as e:
|
||||
stderr.write('Error connecting to spotprices server:\n{}\n'.format(e))
|
||||
exit(1)
|
||||
|
||||
del metals['date']
|
||||
|
||||
try:
|
||||
req = requests.get('http://services.packetizer.com/btc/?f=json')
|
||||
req.raise_for_status()
|
||||
bitcoin = req.json()
|
||||
except requests.exceptions.RequestException as e:
|
||||
stderr.write('Error connecting to bitcoin server:\n{}\n'.format(e))
|
||||
exit(1)
|
||||
|
||||
cnames = [currency[code][0] for code in currency.keys()]
|
||||
crates = [currency[code][1] for code in currency.keys()]
|
||||
|
||||
codestr = '\n'.join('{:23}{}'.
|
||||
format(code, name) for (code,name) in zip(currency.keys(), cnames))
|
||||
|
||||
datestr = date.today().isoformat()
|
||||
|
||||
maxlen = max(len(name) for name in cnames) + 2
|
||||
|
||||
ratestr = '\n'.join(
|
||||
'{:{}}{}'.format(name, maxlen, rate) for (name, rate) in zip(cnames, crates)
|
||||
)
|
||||
|
||||
ozzystr = '\n'.join('{:19}{} US$/troyounce'.format(
|
||||
metal + 'price',
|
||||
price,
|
||||
) for metal, price in metals.items())
|
||||
|
||||
bitcoinstr = '{:{}}{} US$ # From services.packetizer.com/btc\n'.format(
|
||||
'bitcoin',maxlen,bitcoin['usd'])
|
||||
|
||||
outstr = (
|
||||
"""# ISO Currency Codes
|
||||
|
||||
{codestr}
|
||||
|
||||
# Currency exchange rates from Yahoo Finance (finance.yahoo.com)
|
||||
|
||||
!message Currency exchange rates from finance.yahoo.com on {datestr}
|
||||
|
||||
{ratestr}
|
||||
{bitcoinstr}
|
||||
|
||||
# Precious metals prices from Packetizer (services.packetizer.com/spotprices)
|
||||
|
||||
{ozzystr}
|
||||
|
||||
""".format(codestr=codestr, datestr=datestr, ratestr=ratestr, ozzystr=ozzystr,
|
||||
bitcoinstr=bitcoinstr)
|
||||
).replace('\n', linesep)
|
||||
|
||||
try:
|
||||
if outfile_name == '-':
|
||||
codecs.StreamReader(stdout, codecs.getreader('utf8')).write(outstr)
|
||||
else:
|
||||
with codecs.open(outfile_name, 'w', 'utf8') as of:
|
||||
of.write(outstr)
|
||||
except IOError as e:
|
||||
stderr.write('Unable to write to output file:\n{}\n'.format(e))
|
||||
exit(1)
|
||||
24
units.spec
24
units.spec
|
|
@ -1,7 +1,7 @@
|
|||
Summary: A utility for converting amounts from one unit to another
|
||||
Name: units
|
||||
Version: 2.14
|
||||
Release: 3%{?dist}
|
||||
Release: 6%{?dist}
|
||||
Source: https://ftp.gnu.org/gnu/units/%{name}-%{version}.tar.gz
|
||||
URL: https://www.gnu.org/software/units/units.html
|
||||
License: GPLv3+
|
||||
|
|
@ -16,6 +16,15 @@ BuildRequires: readline-devel
|
|||
# used by the units_cur script
|
||||
Requires: python-unidecode
|
||||
|
||||
# units_cur script taken from units-2.15
|
||||
Source1: units-2.15-units_cur
|
||||
|
||||
# units_cur: replace default path properly (#1520027)
|
||||
Patch1: 0001-units-2.14-units_cur-default-path.patch
|
||||
|
||||
# make units_cur work again (#1574835)
|
||||
Patch2: 0002-units-2.15-units_cur.patch
|
||||
|
||||
%description
|
||||
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
|
||||
|
|
@ -24,6 +33,10 @@ well as conversions such as Fahrenheit to Celsius.
|
|||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch1 -p1
|
||||
install -p -m0755 %{SOURCE1} units_cur2
|
||||
%patch2 -p1
|
||||
touch units_cur3
|
||||
|
||||
%build
|
||||
%configure
|
||||
|
|
@ -59,6 +72,15 @@ fi
|
|||
%{_mandir}/man1/*
|
||||
|
||||
%changelog
|
||||
* Mon May 25 2018 Kamil Dudka <kdudka@redhat.com> - 2.14-6
|
||||
- make units_cur work again (#1574835)
|
||||
|
||||
* Mon Dec 04 2017 Kamil Dudka <kdudka@redhat.com> - 2.14-5
|
||||
- units_cur: replace default path properly (#1520027)
|
||||
|
||||
* Tue Oct 31 2017 Kamil Dudka <kdudka@redhat.com> - 2.14-4
|
||||
- update units_cur script from units-2.15 (#1507782)
|
||||
|
||||
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.14-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue