slackware-current/source/x/libkkc/ba1c1bd3eb86d887fc3689c3142732658071b5f7.patch
Patrick J Volkerding 0cbf4c3859 Wed Mar 20 21:10:30 UTC 2024
a/libblockdev-2.28-x86_64-2.txz:  Rebuilt.
  Drop python2 support.
a/sysvinit-scripts-15.1-noarch-15.txz:  Rebuilt.
  rc.M: start rc.iceccd and rc.icecc-scheduler earlier.
a/util-linux-2.39.3-x86_64-2.txz:  Rebuilt.
  Drop python2 support.
a/volume_key-0.3.12-x86_64-6.txz:  Rebuilt.
  Drop python2 support.
ap/man-pages-6.7-noarch-1.txz:  Upgraded.
d/cmake-3.28.4-x86_64-1.txz:  Upgraded.
d/llvm-18.1.2-x86_64-1.txz:  Upgraded.
d/python2-2.7.18-x86_64-7.txz:  Rebuilt.
  Bundle the final python2 versions of pip and setuptools.
  Drop the /usr/bin/python symlink.
d/python3-3.9.19-x86_64-1.txz:  Upgraded.
  Point the /usr/bin/python symlink at python3.9.
  PEP 394 says we can do this, and in a world of ambigious shebangs, this
  is probably the best of the available options.
  This update also fixes security issues:
  bundled libexpat was updated to 2.6.0.
  zipfile is now protected from the "quoted-overlap" zipbomb.
  tempfile.TemporaryDirectory cleanup no longer dereferences symlinks when
  working around file system permission errors.
  For more information, see:
    https://pythoninsider.blogspot.com/2024/03/python-31014-3919-and-3819-is-now.html
    https://www.cve.org/CVERecord?id=CVE-2023-52425
    https://www.cve.org/CVERecord?id=CVE-2024-0450
    https://www.cve.org/CVERecord?id=CVE-2023-6597
  (* Security fix *)
d/strace-6.8-x86_64-1.txz:  Upgraded.
kde/kross-interpreters-23.08.5-x86_64-2.txz:  Rebuilt.
  Drop python2 support.
l/libxml2-2.12.6-x86_64-2.txz:  Rebuilt.
  Drop python2 support.
l/mozjs115-115.9.0esr-x86_64-2.txz:  Rebuilt.
  Fixed installed library name. Thanks to reddog83.
  Fixed slack-desc. Thanks to r1w1s1.
l/phonon-4.12.0-x86_64-1.txz:  Upgraded.
l/pilot-link-0.12.5-x86_64-17.txz:  Rebuilt.
  Drop python2 support.
l/python2-module-collection-2.7.18-x86_64-6.txz:  Removed.
  Good bye!
l/python2-pycairo-1.18.2-x86_64-1.txz:  Added.
  We'll need this (along with pygtk and pygobject) until we get gimp3.
  Well, we could build gimp without python support, but I really don't think
  that's the route we want to take.
n/bind-9.18.25-x86_64-1.txz:  Upgraded.
n/crda-4.15-x86_64-1.txz:  Removed.
  The kernel is able to load from wireless-regdb directly. Obsolete.
n/getmail-6.18.14-x86_64-1.txz:  Upgraded.
n/gpgme-1.23.2-x86_64-2.txz:  Rebuilt.
  Drop python2 support.
n/obexftp-0.24.2-x86_64-11.txz:  Rebuilt.
  Drop python2 support.
n/wireless-regdb-2024.01.23-x86_64-1.txz:  Added.
  Wireless regulatory database, previously bundled with crda.
x/ibus-1.5.29-x86_64-2.txz:  Rebuilt.
  Drop python2 support.
x/libkkc-0.3.5-x86_64-4.txz:  Rebuilt.
  Still forcing python2 with this one, but perhaps a python3 marisa module
  could work around this.
x/libkkc-data-0.2.7-x86_64-4.txz:  Rebuilt.
  Still forcing python2 with this one, but perhaps a python3 marisa module
  could work around this.
x/xcb-proto-1.16.0-x86_64-2.txz:  Rebuilt.
  Drop python2 support.
x/xpyb-1.3.1-x86_64-7.txz:  Removed.
  Nothing uses it, and it was never updated for python3. Removed as obsolete.
2024-03-20 23:08:57 +01:00

138 lines
5.7 KiB
Diff

From ba1c1bd3eb86d887fc3689c3142732658071b5f7 Mon Sep 17 00:00:00 2001
From: Takao Fujiwara <tfujiwar@redhat.com>
Date: Mon, 30 Jul 2018 15:26:37 +0900
Subject: [PATCH] build: Enable python3
---
data/templates/libkkc-data/tools/genfilter.py | 18 +++++++--------
data/templates/libkkc-data/tools/sortlm.py | 23 ++++++++-----------
2 files changed, 19 insertions(+), 22 deletions(-)
diff --git a/data/templates/libkkc-data/tools/genfilter.py b/data/templates/libkkc-data/tools/genfilter.py
index 5ffab32..0c5f75a 100644
--- a/data/templates/libkkc-data/tools/genfilter.py
+++ b/data/templates/libkkc-data/tools/genfilter.py
@@ -84,24 +84,24 @@ def __init__(self, infile, outfile, record_size):
def generate(self):
size = os.fstat(self.infile.fileno()).st_size
- n = size / self.record_size
+ n = size // self.record_size
m = int(math.ceil(-n*math.log10(ERROR_RATE) /
math.pow(math.log10(2), 2)))
- m = (m/8 + 1)*8
+ m = (m//8 + 1)*8
inmem = mmap.mmap(self.infile.fileno(),
size,
access=mmap.ACCESS_READ)
- outmem = bytearray(m/8)
- for i in xrange(0, n):
+ outmem = bytearray(m//8)
+ for i in range(0, n):
offset = i*self.record_size
b0, b1 = struct.unpack("=LL", inmem[offset:offset+8])
- for k in xrange(0, 4):
+ for k in range(0, 4):
h = murmur_hash3_32(b0, b1, k)
h = int(h * (m / float(0xFFFFFFFF)))
- outmem[h/8] |= (1 << (h%8))
+ outmem[h//8] |= (1 << (h%8))
inmem.close()
- # Convert bytearray to str, for Python 2.6 compatibility.
- self.outfile.write(str(outmem))
+ # Convert bytearray to bytes, for Python 3 compatibility.
+ self.outfile.write(bytes(outmem))
if __name__ == '__main__':
import sys
@@ -110,7 +110,7 @@ def generate(self):
parser = argparse.ArgumentParser(description='filter')
parser.add_argument('infile', type=argparse.FileType('r'),
help='input file')
- parser.add_argument('outfile', type=argparse.FileType('w'),
+ parser.add_argument('outfile', type=argparse.FileType('wb'),
help='output file')
parser.add_argument('record_size', type=int,
help='record size')
diff --git a/data/templates/libkkc-data/tools/sortlm.py b/data/templates/libkkc-data/tools/sortlm.py
index a0dd8fe..40f0837 100644
--- a/data/templates/libkkc-data/tools/sortlm.py
+++ b/data/templates/libkkc-data/tools/sortlm.py
@@ -40,10 +40,10 @@ def __init__(self, infile, output_prefix):
self.__min_cost = 0.0
def read(self):
- print "reading N-grams"
+ print("reading N-grams")
self.__read_tries()
self.__read_ngrams()
- print "min cost = %lf" % self.__min_cost
+ print("min cost = %lf" % self.__min_cost)
def __read_tries(self):
while True:
@@ -58,7 +58,7 @@ def __read_tries(self):
line = self.__infile.readline()
if line == "":
break
- line = line.strip()
+ line = line.strip('\n')
if line == "":
break
match = self.__ngram_line_regex.match(line)
@@ -89,7 +89,7 @@ def __read_ngrams(self):
line = self.__infile.readline()
if line == "":
break
- line = line.strip()
+ line = line.strip('\n')
if line == "":
break
match = self.__ngram_line_regex.match(line)
@@ -125,14 +125,11 @@ def __write_ngrams(self):
def quantize(cost, min_cost):
return max(0, min(65535, int(cost * 65535 / min_cost)))
- def cmp_header(a, b):
- return cmp(a[0], b[0])
-
- print "writing 1-gram file"
+ print("writing 1-gram file")
unigram_offsets = {}
unigram_file = open("%s.1gram" % self.__output_prefix, "wb")
offset = 0
- for ids, value in sorted(self.__ngram_entries[0].iteritems()):
+ for ids, value in sorted(self.__ngram_entries[0].items()):
unigram_offsets[ids[0]] = offset
s = struct.pack("=HHH",
quantize(value[0], self.__min_cost),
@@ -143,13 +140,13 @@ def cmp_header(a, b):
offset += 1
unigram_file.close()
- print "writing 2-gram file"
+ print("writing 2-gram file")
bigram_offsets = {}
bigram_file = open("%s.2gram" % self.__output_prefix, "wb")
keys = self.__ngram_entries[1].keys()
items = [(struct.pack("=LL", ids[1], unigram_offsets[ids[0]]), ids) for ids in keys]
offset = 0
- for header, ids in sorted(items, cmp=cmp_header):
+ for header, ids in sorted(items, key=lambda x: x[0]):
value = self.__ngram_entries[1][ids]
bigram_offsets[ids] = offset
s = struct.pack("=HH",
@@ -160,11 +157,11 @@ def cmp_header(a, b):
bigram_file.close()
if len(self.__ngram_entries[2]) > 0:
- print "writing 3-gram file"
+ print("writing 3-gram file")
trigram_file = open("%s.3gram" % self.__output_prefix, "wb")
keys = self.__ngram_entries[2].keys()
items = [(struct.pack("=LL", ids[2], bigram_offsets[(ids[0], ids[1])]), ids) for ids in keys]
- for header, ids in sorted(items, cmp=cmp_header):
+ for header, ids in sorted(items, key=lambda x: x[0]):
value = self.__ngram_entries[2][ids]
s = struct.pack("=H",
quantize(value[0], self.__min_cost))