git: f88c6231d2c5 - main - math/py-pybloom: Fix build with setuptools 58.0.0+

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Fri, 25 Mar 2022 13:50:35 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f88c6231d2c52a75d007577ed6a96261b170697d

commit f88c6231d2c52a75d007577ed6a96261b170697d
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2022-03-25 13:32:48 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2022-03-25 13:38:16 +0000

    math/py-pybloom: Fix build with setuptools 58.0.0+
    
    With hat:       python
---
 math/py-pybloom/files/patch-2to3 | 60 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/math/py-pybloom/files/patch-2to3 b/math/py-pybloom/files/patch-2to3
new file mode 100644
index 000000000000..ccba959e2111
--- /dev/null
+++ b/math/py-pybloom/files/patch-2to3
@@ -0,0 +1,60 @@
+--- pybloom_live/benchmarks.py.orig	2018-07-22 09:08:15 UTC
++++ pybloom_live/benchmarks.py
+@@ -2,9 +2,9 @@
+ #
+ """Test performance of BloomFilter at a set capacity and error rate."""
+ import sys
+-from pybloom import BloomFilter
++from .pybloom import BloomFilter
+ import bitarray, math, time
+-from utils import range_fn
++from .utils import range_fn
+ 
+ 
+ def main(capacity=100000, request_error_rate=0.1):
+@@ -14,18 +14,18 @@ def main(capacity=100000, request_error_rate=0.1):
+     for i in range_fn(0, f.capacity):
+         f.add(i, skip_check=True)
+     end = time.time()
+-    print("{:5.3f} seconds to add to capacity, {:10.2f} entries/second".format(
+-            end - start, f.capacity / (end - start)))
++    print(("{:5.3f} seconds to add to capacity, {:10.2f} entries/second".format(
++            end - start, f.capacity / (end - start))))
+     oneBits = f.bitarray.count(True)
+     zeroBits = f.bitarray.count(False)
+-    print "Number of 1 bits:", oneBits
+-    print "Number of 0 bits:", zeroBits
+-    print("Number of Filter Bits:", f.num_bits)
+-    print("Number of slices:", f.num_slices)
+-    print("Bits per slice:", f.bits_per_slice)
++    print("Number of 1 bits:", oneBits)
++    print("Number of 0 bits:", zeroBits)
++    print(("Number of Filter Bits:", f.num_bits))
++    print(("Number of slices:", f.num_slices))
++    print(("Bits per slice:", f.bits_per_slice))
+     print("------")
+-    print("Fraction of 1 bits at capacity: {:5.3f}".format(
+-            oneBits / float(f.num_bits)))
++    print(("Fraction of 1 bits at capacity: {:5.3f}".format(
++            oneBits / float(f.num_bits))))
+     # Look for false positives and measure the actual fp rate
+     trials = f.capacity
+     fp = 0
+@@ -36,14 +36,14 @@ def main(capacity=100000, request_error_rate=0.1):
+     end = time.time()
+     print(("{:5.3f} seconds to check false positives, "
+            "{:10.2f} checks/second".format(end - start, trials / (end - start))))
+-    print("Requested FP rate: {:2.4f}".format(request_error_rate))
+-    print("Experimental false positive rate: {:2.4f}".format(fp / float(trials)))
++    print(("Requested FP rate: {:2.4f}".format(request_error_rate)))
++    print(("Experimental false positive rate: {:2.4f}".format(fp / float(trials))))
+     # Compute theoretical fp max (Goel/Gupta)
+     k = f.num_slices
+     m = f.num_bits
+     n = f.capacity
+     fp_theory = math.pow((1 - math.exp(-k * (n + 0.5) / (m - 1))), k)
+-    print("Projected FP rate (Goel/Gupta): {:2.6f}".format(fp_theory))
++    print(("Projected FP rate (Goel/Gupta): {:2.6f}".format(fp_theory)))
+ 
+ if __name__ == '__main__':
+     main()