diff options
-rw-r--r-- | sci-calculators/units/Manifest | 1 | ||||
-rw-r--r-- | sci-calculators/units/files/units-2.20-readerror.patch | 11 | ||||
-rw-r--r-- | sci-calculators/units/files/units_cur-urllib.patch | 117 | ||||
-rw-r--r-- | sci-calculators/units/metadata.xml | 8 | ||||
-rw-r--r-- | sci-calculators/units/units-2.23-r1.ebuild | 57 |
5 files changed, 0 insertions, 194 deletions
diff --git a/sci-calculators/units/Manifest b/sci-calculators/units/Manifest deleted file mode 100644 index 0dcbf6b..0000000 --- a/sci-calculators/units/Manifest +++ /dev/null @@ -1 +0,0 @@ -DIST units-2.23.tar.gz 1423494 BLAKE2B 9a835ec3862b7c09149d5726084fb3068acb9d01b3a8234647cd47805a559b75131046bfe407152dec9f2e06c6c3315686dd0db0694d2c5ef0173e6ee64ce378 SHA512 628aac3a560ed728f1aba91841f9fccc0b145375a0b8953b98ac00c71bcc7f647377d16c6ba7b59e987a6e7a74b44038a62f2576f757a43d7564be469be81ee8 diff --git a/sci-calculators/units/files/units-2.20-readerror.patch b/sci-calculators/units/files/units-2.20-readerror.patch deleted file mode 100644 index ccb12c6..0000000 --- a/sci-calculators/units/files/units-2.20-readerror.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/units.c -+++ b/units.c -@@ -761,7 +761,7 @@ - } - - --#define readerror (goterr=1) && errfile && fprintf -+#define readerror(...) do { goterr=1; if (errfile) fprintf(__VA_ARGS__); } while (0) - - #define VAGUE_ERR "%s: error in units file '%s' line %d\n", \ - progname, file, linenum diff --git a/sci-calculators/units/files/units_cur-urllib.patch b/sci-calculators/units/files/units_cur-urllib.patch deleted file mode 100644 index 29c6012..0000000 --- a/sci-calculators/units/files/units_cur-urllib.patch +++ /dev/null @@ -1,117 +0,0 @@ ---- a/units_cur -+++ b/units_cur -@@ -28,8 +28,12 @@ - # - # - --version = '5.0' -+version = '5.1' - -+# Version 5.1: -+# -+# Switch to urllib to avoid requests dependency. -+# - # Version 5.0: - # - # Rewrite to support multiple different data sources due to disappearance -@@ -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 urllib.error -+import urllib.parse -+import urllib.request - from argparse import ArgumentParser - from collections import OrderedDict - from datetime import date -@@ -303,11 +309,12 @@ - currency[code][rate_index])) - - def getjson(address,args=None): -+ if args: -+ address = address + "?" + urllib.parse.urlencode(args) - try: -- res = requests.get(address,args) -- res.raise_for_status() -- return(res.json()) -- except requests.exceptions.RequestException as e: -+ res = urllib.request.urlopen(address) -+ return(json.load(res)) -+ except urllib.error.URLError as e: - stderr.write('Error connecting to currency server:\n{}.\n'.format(e)) - exit(1) - -@@ -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: -- res=requests.get('https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml') -- res.raise_for_status() -- data = ET.fromstring(res.content)[2][0] -- 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/metadata.xml b/sci-calculators/units/metadata.xml deleted file mode 100644 index fc2b905..0000000 --- a/sci-calculators/units/metadata.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> -<pkgmetadata> -<!-- maintainer-needed --> -<use> -<flag name="units-cur">Install the units_cur python script that updates currencies</flag> -</use> -</pkgmetadata> diff --git a/sci-calculators/units/units-2.23-r1.ebuild b/sci-calculators/units/units-2.23-r1.ebuild deleted file mode 100644 index c5ddc81..0000000 --- a/sci-calculators/units/units-2.23-r1.ebuild +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 1999-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -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+" -SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux" -IUSE="+units-cur" -REQUIRED_USE="units-cur? ( ${PYTHON_REQUIRED_USE} )" - -RDEPEND=" - sys-libs/readline:= - units-cur? ( - ${PYTHON_DEPS} - ) -" -DEPEND="${RDEPEND}" - -PATCHES=( - "${FILESDIR}"/${PN}-2.20-readerror.patch - "${FILESDIR}"/units_cur-urllib.patch -) - -DOCS=( NEWS README ) - -src_configure() { - local myconf=( - --sharedstatedir="${EPREFIX}"/var/lib - ac_cv_path_PYTHON=no - ) - - econf "${myconf[@]}" -} - -src_compile() { - emake ${PN} -} - -src_install() { - default - - if use units-cur; then - sed \ - -e "/^outfile/s|'.*'|'/usr/share/units/currency.units'|g" \ - -e 's|^#!|&/usr/bin/python|g' \ - units_cur_inst > units_cur || die - python_foreach_impl python_doscript units_cur - fi -} |