diff options
-rw-r--r-- | sci-calculators/units/Manifest | 2 | ||||
-rw-r--r-- | sci-calculators/units/files/units-2.17-network-sandbox.patch | 11 | ||||
-rw-r--r-- | sci-calculators/units/files/units_cur-urllib.patch | 84 | ||||
-rw-r--r-- | sci-calculators/units/units-2.23-r1.ebuild (renamed from sci-calculators/units/units-2.21-r2.ebuild) | 16 |
4 files changed, 81 insertions, 32 deletions
diff --git a/sci-calculators/units/Manifest b/sci-calculators/units/Manifest index 62a5de3..0dcbf6b 100644 --- a/sci-calculators/units/Manifest +++ b/sci-calculators/units/Manifest @@ -1 +1 @@ -DIST units-2.21.tar.gz 1308533 BLAKE2B 0a02979eafa21af759128ec72b11e1f532640c9d0e88ae8f389a1beb52d5a400cbd6294042aa4c7d8786c06c8ac4106a77c302805b8c5e3bb84d4134805fd517 SHA512 34bacff606f12aa5b2e59170f6b2142277aa1121d79610a51b57f07f17ae2dbdfbbb0e60be34522f367679cc152408f77c1ebb551016224d23f81c21f4b3ba62 +DIST units-2.23.tar.gz 1423494 BLAKE2B 9a835ec3862b7c09149d5726084fb3068acb9d01b3a8234647cd47805a559b75131046bfe407152dec9f2e06c6c3315686dd0db0694d2c5ef0173e6ee64ce378 SHA512 628aac3a560ed728f1aba91841f9fccc0b145375a0b8953b98ac00c71bcc7f647377d16c6ba7b59e987a6e7a74b44038a62f2576f757a43d7564be469be81ee8 diff --git a/sci-calculators/units/files/units-2.17-network-sandbox.patch b/sci-calculators/units/files/units-2.17-network-sandbox.patch deleted file mode 100644 index e457610..0000000 --- a/sci-calculators/units/files/units-2.17-network-sandbox.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/Makefile.in -+++ b/Makefile.in -@@ -107,7 +107,7 @@ - -e "s@/usr/bin/python@$(PYTHON)@" \ - $(srcdir)/units_cur > units_cur_inst - --install-support: definitions.units units_cur_inst currency-units-update -+install-support: definitions.units units_cur_inst - $(MKDIR_P) $(DESTDIR)@UDAT@ $(DESTDIR)$(bindir) $(DESTDIR)@CDAT@ - $(INSTALL_DATA) $(srcdir)/definitions.units $(DESTDIR)@UDAT@definitions.units - -rm -f $(DESTDIR)@UDAT@currency.units diff --git a/sci-calculators/units/files/units_cur-urllib.patch b/sci-calculators/units/files/units_cur-urllib.patch index b0c61f9..29c6012 100644 --- a/sci-calculators/units/files/units_cur-urllib.patch +++ b/sci-calculators/units/files/units_cur-urllib.patch @@ -1,6 +1,5 @@ -diff -ru a/units_cur b/units_cur ---- a/units_cur 2018-09-15 16:30:09.000000000 -0400 -+++ b/units_cur 2021-07-11 18:01:29.030260473 -0400 +--- a/units_cur ++++ b/units_cur @@ -28,8 +28,12 @@ # # @@ -15,20 +14,20 @@ diff -ru a/units_cur b/units_cur # Version 5.0: # # Rewrite to support multiple different data sources due to disappearance -@@ -54,8 +58,11 @@ +@@ -54,9 +58,11 @@ # Python 2 or Python 3. Thanks to Ray Hamel for some help with this update. # Normal imports -import requests import codecs -+import json + import json +import urllib.error +import urllib.parse +import urllib.request from argparse import ArgumentParser from collections import OrderedDict from datetime import date -@@ -288,11 +295,12 @@ +@@ -303,11 +309,12 @@ currency[code][rate_index])) def getjson(address,args=None): @@ -45,15 +44,74 @@ diff -ru a/units_cur b/units_cur stderr.write('Error connecting to currency server:\n{}.\n'.format(e)) exit(1) -@@ -323,9 +331,8 @@ +@@ -337,14 +344,8 @@ + if verbose and base!='EUR': stderr.write('European bank uses euro for base currency. Specified base {} ignored.\n'.format(base)) import xml.etree.ElementTree as ET - try: +- try: - res=requests.get('https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml') - res.raise_for_status() - data = ET.fromstring(res.content)[2][0] -+ res=urllib.request.urlopen('https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml') -+ data = ET.fromstring(res.read())[2][0] - except requests.exceptions.RequestException as e: - stderr.write('Error connecting to currency server:\n{}.\n'. - format(e)) +- except requests.exceptions.RequestException as e: +- stderr.write('Error connecting to currency server:\n{}.\n'. +- format(e)) +- exit(1) ++ res=urllib.request.urlopen('https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml') ++ data = ET.fromstring(res.read())[2][0] + for entry in data.iter(): + if entry.get('time'): + continue +@@ -596,7 +597,6 @@ + docpi=True + + if docpi: +- headers = {'Content-type': 'application/json'} + yearlist = list(range(date.today().year,1912,-10)) + if yearlist[-1]>1912: + yearlist.append(1912) +@@ -605,29 +605,18 @@ + query = {"seriesid": ['CUUR0000SA0']} + if cpikey: + query["registrationkey"]=cpikey +- ######################################################################## +- # The api.bls.gov site currently (2024-02-15) resolves to an +- # IPv4 address which works, and an IPv6 address which does +- # not. The urllib3 package does not currently implement the +- # Happy Eyeballs algorithm, nor any other mechanism to re-try +- # hung connections with alternative addresses returned by DNS. +- # In the interest of expediency, we temporarily force the +- # connection to api.bls.gov to only use IPv4; hopefully at +- # some future date either urllib3 will gain the necessary +- # features and/or the BLS will fix their configuration so +- # that all A and AAAA records for api.bls.gov resolve to an +- # operational server. At that time we can remove the three +- # references to "requests.packages.urllib3.util.connection.HAS_IPV6" +- # in this function. +- ######################################################################## +- save_rpuucH = requests.packages.urllib3.util.connection.HAS_IPV6 +- requests.packages.urllib3.util.connection.HAS_IPV6 = False + for endyear in range(len(yearlist)-1): + query["startyear"]=str(yearlist[endyear+1]+1) + query["endyear"]=str(yearlist[endyear]) + data = json.dumps(query) +- p = requests.post('https://api.bls.gov/publicAPI/v2/timeseries/data/', data=data, headers=headers) +- json_data = json.loads(p.text) ++ p = urllib.request.urlopen( ++ urllib.request.Request( ++ 'https://api.bls.gov/publicAPI/v2/timeseries/data/', ++ data=json.dumps(query), ++ headers={'Content-type': 'application/json'} ++ ) ++ ) ++ json_data = json.load(p) + if json_data['status']=="REQUEST_NOT_PROCESSED": + docpi=False + stderr.write("Unable to update CPI data: Exceeded daily threshold for BLS requests\n") +@@ -644,7 +633,6 @@ + lastyear=year + firstcpi=value + firstyear=year +- requests.packages.urllib3.util.connection.HAS_IPV6 = save_rpuucH + if docpi: # Check again because request may have failed + cpi.reverse() + cpistr = '\n'.join(cpi) diff --git a/sci-calculators/units/units-2.21-r2.ebuild b/sci-calculators/units/units-2.23-r1.ebuild index d44ccf9..c5ddc81 100644 --- a/sci-calculators/units/units-2.21-r2.ebuild +++ b/sci-calculators/units/units-2.23-r1.ebuild @@ -1,16 +1,16 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 -PYTHON_COMPAT=( python3_{8..11} ) +PYTHON_COMPAT=( python3_{10..13} ) inherit python-r1 DESCRIPTION="Unit conversion program" HOMEPAGE="https://www.gnu.org/software/units/units.html" SRC_URI="mirror://gnu/${PN}/${P}.tar.gz" -LICENSE="FDL-1.3 GPL-3" +LICENSE="FDL-1.3 GPL-3+" SLOT="0" KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux" IUSE="+units-cur" @@ -25,17 +25,19 @@ RDEPEND=" DEPEND="${RDEPEND}" PATCHES=( - "${FILESDIR}"/${PN}-2.17-network-sandbox.patch "${FILESDIR}"/${PN}-2.20-readerror.patch "${FILESDIR}"/units_cur-urllib.patch ) -DOCS=( ChangeLog NEWS README ) +DOCS=( NEWS README ) src_configure() { - econf \ - --sharedstatedir="${EPREFIX}"/var/lib \ + local myconf=( + --sharedstatedir="${EPREFIX}"/var/lib ac_cv_path_PYTHON=no + ) + + econf "${myconf[@]}" } src_compile() { |