Github messages for voidlinux
 help / color / mirror / Atom feed
From: tornaria <tornaria@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] Fix cross-build for cysignals, cypari2, fpylll, primecountpy, pplpy
Date: Thu, 19 Oct 2023 03:53:23 +0200	[thread overview]
Message-ID: <20231019015323.fbRRHdT2t57x2-K3Q0C_ZZ6cCPcX61NWQOC4nRg8stw@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-46738@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1727 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages cysignals
https://github.com/void-linux/void-packages/pull/46738

Fix cross-build for cysignals, cypari2, fpylll, primecountpy, pplpy
Summary of changes:
- python3-cysignals: update to 1.11.4, fix cross-build.
- python3-cypari2: update to 2.1.4, fix cross-build.
- fplll: update to 5.4.5.
- python3-fpylll: update to 0.6.0, fix cross-build.
- python3-primecountpy: fix cross-build.
- python3-pplpy: update to 0.8.9, fix cross-build.

#### Testing the changes
- I tested the changes in this PR: **briefly**

Note that pplpy is still building with Cython0.29 as the cython version has to match the one used to build sagemath. We'll switch to Cython 3 when sagemath 10.2 is released.

@dkwo some cross pkgs for you.

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/46738.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-cysignals-46738.patch --]
[-- Type: text/x-diff, Size: 28049 bytes --]

From 9a1c7cdf8d1804e0539e9774ad80a45c85879df0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 8 Oct 2023 19:40:27 -0300
Subject: [PATCH 1/6] python3-cysignals: update to 1.11.4, fix cross-build.

---
 .../python3-cysignals/patches/fix-cross.patch | 23 +++++++++++++++
 srcpkgs/python3-cysignals/template            | 28 ++++++++++++++-----
 2 files changed, 44 insertions(+), 7 deletions(-)
 create mode 100644 srcpkgs/python3-cysignals/patches/fix-cross.patch

diff --git a/srcpkgs/python3-cysignals/patches/fix-cross.patch b/srcpkgs/python3-cysignals/patches/fix-cross.patch
new file mode 100644
index 0000000000000..8d08c516e0eb1
--- /dev/null
+++ b/srcpkgs/python3-cysignals/patches/fix-cross.patch
@@ -0,0 +1,23 @@
+diff --git a/configure.ac b/configure.ac
+index d0624ec..f5a6786 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -48,7 +48,7 @@ fi
+ AC_MSG_CHECKING([for emms instruction])
+ # We add the "leal" instruction to reduce false positives in case some
+ # non-x86 architecture also has an "emms" instruction.
+-AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[asm("leal (%eax), %eax; emms");]])],
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[asm("leal (%eax), %eax; emms");]])],
+     dnl YES
+     [AC_MSG_RESULT([yes])]
+     AC_DEFINE(HAVE_EMMS, 1, [Define to 1 if your processor understands the "emms" instruction.])
+@@ -84,6 +84,9 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM(
+     ,
+     dnl NO
+     [AC_MSG_RESULT([no])]
++    ,
++    [AC_MSG_RESULT([cross, assume yes])]
++    sigsetjmp=yes
+ )
+ 
+ AC_MSG_CHECKING([for GNU libc])
diff --git a/srcpkgs/python3-cysignals/template b/srcpkgs/python3-cysignals/template
index da80babe1fcb1..64289ad95dc0f 100644
--- a/srcpkgs/python3-cysignals/template
+++ b/srcpkgs/python3-cysignals/template
@@ -1,19 +1,33 @@
 # Template file for 'python3-cysignals'
 pkgname=python3-cysignals
-version=1.11.3
+version=1.11.4
 revision=1
-build_style=python3-module
-hostmakedepends="python3-setuptools python3-Cython autoconf"
+# need gnu-configure build style to support cross build
+build_style=gnu-configure
+build_helper=python3
+hostmakedepends="python3-setuptools python3-wheel python3-Cython
+ python3-build python3-installer autoconf"
 makedepends="python3-devel pari-devel"
 depends="python3"
 short_desc="Interrupt and signal handling for Cython"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="LGPL-3.0-or-later"
 homepage="https://github.com/sagemath/cysignals"
+changelog="https://github.com/sagemath/cysignals/releases"
 distfiles="${PYPI_SITE}/c/cysignals/cysignals-${version}.tar.gz"
-checksum=c2c01f666e5904948952a2250548d8c36ccedd640383791feacf26ea2b958365
-nocross=yes # runs binaries built for target
+checksum=0f1e321e55a07f901c86a36a1e4497f6ff9dfe700681d0130a38c36e4eb238c3
 
-do_check() {
-	make check
+pre_configure() {
+	# run autoconf because we patched configure.ac
+	autoconf
+}
+
+do_build() {
+	# build as in python3-pep517 build style
+	python3 -m build --no-isolation --wheel .
+}
+
+do_install() {
+	# install as in python3-pep517 build style
+	python3 -m installer --destdir ${DESTDIR} --no-compile-bytecode dist/*.whl
 }

From 64935c6e4d1e8413d8a758d1fe90416bed55ab1f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 16 Oct 2023 16:47:38 -0300
Subject: [PATCH 2/6] python3-cypari2: update to 2.1.4, fix cross-build.

---
 .../patches/cython3-legacy.patch              |  32 ---
 .../python3-cypari2/patches/python312.patch   | 214 ------------------
 srcpkgs/python3-cypari2/template              |  14 +-
 3 files changed, 8 insertions(+), 252 deletions(-)
 delete mode 100644 srcpkgs/python3-cypari2/patches/cython3-legacy.patch
 delete mode 100644 srcpkgs/python3-cypari2/patches/python312.patch

diff --git a/srcpkgs/python3-cypari2/patches/cython3-legacy.patch b/srcpkgs/python3-cypari2/patches/cython3-legacy.patch
deleted file mode 100644
index 41392fe80d736..0000000000000
--- a/srcpkgs/python3-cypari2/patches/cython3-legacy.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-commit 8ef356a4eb936c37f55a5c501f3a955e6740c0c5
-Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
-Date:   Wed Jul 19 19:45:23 2023 -0300
-
-    cython3 support using legacy directives
-
-diff --git a/cypari2/gen.pyx b/cypari2/gen.pyx
-index 247b1ad..75050a0 100644
---- a/cypari2/gen.pyx
-+++ b/cypari2/gen.pyx
-@@ -329,7 +329,7 @@ cdef class Gen(Gen_base):
-         >>> pari = Pari()
-         >>> L = pari("vector(10,i,i^2)")
-         >>> L.__iter__()
--        <generator object at ...>
-+        <...generator object at ...>
-         >>> [x for x in L]
-         [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
-         >>> list(L)
-diff --git a/setup.py b/setup.py
-index 2188711..455337f 100755
---- a/setup.py
-+++ b/setup.py
-@@ -36,6 +36,8 @@ class build_ext(_build_ext):
-             "binding": True,
-             "cdivision": True,
-             "language_level": 2,
-+            "legacy_implicit_noexcept": True,
-+            "c_api_binop_methods": True,
-         }
- 
-         _build_ext.finalize_options(self)
diff --git a/srcpkgs/python3-cypari2/patches/python312.patch b/srcpkgs/python3-cypari2/patches/python312.patch
deleted file mode 100644
index 255cfb9f1fb75..0000000000000
--- a/srcpkgs/python3-cypari2/patches/python312.patch
+++ /dev/null
@@ -1,214 +0,0 @@
-From 0c7e9a1749d67ef1b880283112e968f644e24341 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 2 Oct 2023 07:47:14 -0300
-Subject: [PATCH] Support python 3.12
-
----
- cypari2/Py_SET_SIZE.h   |  8 ----
- cypari2/convert.pyx     | 27 ++++--------
- cypari2/pycore_long.h   | 98 +++++++++++++++++++++++++++++++++++++++++
- cypari2/pycore_long.pxd |  9 ++++
- 4 files changed, 116 insertions(+), 26 deletions(-)
- delete mode 100644 cypari2/Py_SET_SIZE.h
- create mode 100644 cypari2/pycore_long.h
- create mode 100644 cypari2/pycore_long.pxd
-
-diff --git a/cypari2/Py_SET_SIZE.h b/cypari2/Py_SET_SIZE.h
-deleted file mode 100644
-index 5f18ab0..0000000
---- a/cypari2/Py_SET_SIZE.h
-+++ /dev/null
-@@ -1,8 +0,0 @@
--#include "Python.h"
--
--#if (PY_MAJOR_VERSION == 3) && (PY_MINOR_VERSION < 9)
--// The function Py_SET_SIZE is defined starting with python 3.9.
--void Py_SET_SIZE(PyVarObject *o, Py_ssize_t size){
--    Py_SIZE(o) = size;
--}
--#endif
-diff --git a/cypari2/convert.pyx b/cypari2/convert.pyx
-index 7c2ed24..8d39c3c 100644
---- a/cypari2/convert.pyx
-+++ b/cypari2/convert.pyx
-@@ -54,14 +54,8 @@ from libc.math cimport INFINITY
- from .paridecl cimport *
- from .stack cimport new_gen, reset_avma
- from .string_utils cimport to_string, to_bytes
--
--cdef extern from *:
--    ctypedef struct PyLongObject:
--        digit* ob_digit
--
--cdef extern from "Py_SET_SIZE.h":
--    void Py_SET_SIZE(py_long o, Py_ssize_t size)
--
-+from .pycore_long cimport (ob_digit, _PyLong_IsZero, _PyLong_IsNegative,
-+        _PyLong_IsPositive, _PyLong_DigitCount, _PyLong_SetSignAndDigitCount)
- 
- ########################################################################
- # Conversion PARI -> Python
-@@ -424,7 +418,7 @@ cdef PyLong_FromINT(GEN g):
-     cdef Py_ssize_t sizedigits_final = 0
- 
-     cdef py_long x = _PyLong_New(sizedigits)
--    cdef digit* D = x.ob_digit
-+    cdef digit* D = ob_digit(x)
- 
-     cdef digit d
-     cdef ulong w
-@@ -452,10 +446,7 @@ cdef PyLong_FromINT(GEN g):
-             sizedigits_final = i+1
- 
-     # Set correct size
--    if signe(g) > 0:
--        Py_SET_SIZE(x, sizedigits_final)
--    else:
--        Py_SET_SIZE(x, -sizedigits_final)
-+    _PyLong_SetSignAndDigitCount(x, signe(g), sizedigits_final)
- 
-     return x
- 
-@@ -465,18 +456,18 @@ cdef PyLong_FromINT(GEN g):
- ########################################################################
- 
- cdef GEN PyLong_AS_GEN(py_long x):
--    cdef const digit* D = x.ob_digit
-+    cdef const digit* D = ob_digit(x)
- 
-     # Size of the input
-     cdef size_t sizedigits
-     cdef long sgn
--    if Py_SIZE(x) == 0:
-+    if _PyLong_IsZero(x):
-         return gen_0
--    elif Py_SIZE(x) > 0:
--        sizedigits = Py_SIZE(x)
-+    elif _PyLong_IsPositive(x):
-+        sizedigits = _PyLong_DigitCount(x)
-         sgn = evalsigne(1)
-     else:
--        sizedigits = -Py_SIZE(x)
-+        sizedigits = _PyLong_DigitCount(x)
-         sgn = evalsigne(-1)
- 
-     # Size of the output, in bits and in words
-diff --git a/cypari2/pycore_long.h b/cypari2/pycore_long.h
-new file mode 100644
-index 0000000..ff1a73d
---- /dev/null
-+++ b/cypari2/pycore_long.h
-@@ -0,0 +1,98 @@
-+#include "Python.h"
-+#include <stdbool.h>
-+
-+#if PY_VERSION_HEX >= 0x030C00A5
-+#define ob_digit(o)  (((PyLongObject*)o)->long_value.ob_digit)
-+#else
-+#define ob_digit(o)  (((PyLongObject*)o)->ob_digit)
-+#endif
-+
-+#if PY_VERSION_HEX >= 0x030C00A7
-+// taken from cpython:Include/internal/pycore_long.h @ 3.12
-+
-+/* Long value tag bits:
-+ * 0-1: Sign bits value = (1-sign), ie. negative=2, positive=0, zero=1.
-+ * 2: Reserved for immortality bit
-+ * 3+ Unsigned digit count
-+ */
-+#define SIGN_MASK 3
-+#define SIGN_ZERO 1
-+#define SIGN_NEGATIVE 2
-+#define NON_SIZE_BITS 3
-+
-+static inline bool
-+_PyLong_IsZero(const PyLongObject *op)
-+{
-+    return (op->long_value.lv_tag & SIGN_MASK) == SIGN_ZERO;
-+}
-+
-+static inline bool
-+_PyLong_IsNegative(const PyLongObject *op)
-+{
-+    return (op->long_value.lv_tag & SIGN_MASK) == SIGN_NEGATIVE;
-+}
-+
-+static inline bool
-+_PyLong_IsPositive(const PyLongObject *op)
-+{
-+    return (op->long_value.lv_tag & SIGN_MASK) == 0;
-+}
-+
-+static inline Py_ssize_t
-+_PyLong_DigitCount(const PyLongObject *op)
-+{
-+    assert(PyLong_Check(op));
-+    return op->long_value.lv_tag >> NON_SIZE_BITS;
-+}
-+
-+#define TAG_FROM_SIGN_AND_SIZE(sign, size) ((1 - (sign)) | ((size) << NON_SIZE_BITS))
-+
-+static inline void
-+_PyLong_SetSignAndDigitCount(PyLongObject *op, int sign, Py_ssize_t size)
-+{
-+    assert(size >= 0);
-+    assert(-1 <= sign && sign <= 1);
-+    assert(sign != 0 || size == 0);
-+    op->long_value.lv_tag = TAG_FROM_SIGN_AND_SIZE(sign, (size_t)size);
-+}
-+
-+#else
-+// fallback for < 3.12
-+
-+static inline bool
-+_PyLong_IsZero(const PyLongObject *op)
-+{
-+    return Py_SIZE(op) == 0;
-+}
-+
-+static inline bool
-+_PyLong_IsNegative(const PyLongObject *op)
-+{
-+    return Py_SIZE(op) < 0;
-+}
-+
-+static inline bool
-+_PyLong_IsPositive(const PyLongObject *op)
-+{
-+    return Py_SIZE(op) > 0;
-+}
-+
-+static inline Py_ssize_t
-+_PyLong_DigitCount(const PyLongObject *op)
-+{
-+    Py_ssize_t size = Py_SIZE(op);
-+    return size < 0 ? -size : size;
-+}
-+
-+static inline void
-+_PyLong_SetSignAndDigitCount(PyLongObject *op, int sign, Py_ssize_t size)
-+{
-+#if (PY_MAJOR_VERSION == 3) && (PY_MINOR_VERSION < 9)
-+// The function Py_SET_SIZE is defined starting with python 3.9.
-+    Py_SIZE(o) = size;
-+#else
-+    Py_SET_SIZE(op, sign < 0 ? -size : size);
-+#endif
-+}
-+
-+#endif
-diff --git a/cypari2/pycore_long.pxd b/cypari2/pycore_long.pxd
-new file mode 100644
-index 0000000..41de637
---- /dev/null
-+++ b/cypari2/pycore_long.pxd
-@@ -0,0 +1,9 @@
-+from cpython.longintrepr cimport py_long, digit
-+
-+cdef extern from "pycore_long.h":
-+    digit* ob_digit(py_long o)
-+    bint _PyLong_IsZero(py_long o)
-+    bint _PyLong_IsNegative(py_long o)
-+    bint _PyLong_IsPositive(py_long o)
-+    Py_ssize_t _PyLong_DigitCount(py_long o)
-+    void _PyLong_SetSignAndDigitCount(py_long o, int sign, Py_ssize_t size)
diff --git a/srcpkgs/python3-cypari2/template b/srcpkgs/python3-cypari2/template
index c93052ba52bce..7e359e790f57e 100644
--- a/srcpkgs/python3-cypari2/template
+++ b/srcpkgs/python3-cypari2/template
@@ -1,18 +1,20 @@
 # Template file for 'python3-cypari2'
 pkgname=python3-cypari2
-version=2.1.3
-revision=5
-build_style=python3-module
-hostmakedepends="python3-setuptools python3-Cython pari perl"
-makedepends="python3-devel python3-cysignals pari-devel gmp-devel"
+version=2.1.4
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-setuptools python3-wheel python3-Cython
+ python3-cysignals pari perl"
+makedepends="python3-devel pari-devel gmp-devel"
 depends="python3-cysignals"
 checkdepends="${depends} python3-pytest"
 short_desc="Python interface to the number theory library PARI/GP"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="https://github.com/sagemath/cypari2"
+changelog="https://github.com/sagemath/cypari2/releases"
 distfiles="https://github.com/sagemath/cypari2/archive/refs/tags/${version}.tar.gz"
-checksum=6f6f6ca2b2c2dbef4444727e8fb8652b090cfac4297ba959e94b3a91bbd86548
+checksum=95daf1a74275a35730bbca75144776c1bb0594dd90af82ebf7bf96bb1a52c3d8
 
 do_check() {
 	# Please do not disable this custom check;

From c0ee0ddf1b80d8846810ac8cd81dd1fb55a5301c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Tue, 17 Oct 2023 17:28:40 -0300
Subject: [PATCH 3/6] fplll: update to 5.4.5.

---
 srcpkgs/fplll/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/fplll/template b/srcpkgs/fplll/template
index 9843d46828414..74fb8744ef51a 100644
--- a/srcpkgs/fplll/template
+++ b/srcpkgs/fplll/template
@@ -1,6 +1,6 @@
 # Template file for 'fplll'
 pkgname=fplll
-version=5.4.4
+version=5.4.5
 revision=1
 build_style=gnu-configure
 makedepends="gmp-devel mpfr-devel"
@@ -10,7 +10,7 @@ license="LGPL-2.1-or-later"
 homepage="https://github.com/fplll/fplll"
 changelog="https://github.com/fplll/fplll/releases"
 distfiles="https://github.com/fplll/fplll/releases/download/${version}/fplll-${version}.tar.gz"
-checksum=0fd9d378f04ff886d8864728baf5d90b8b0b82c1e541e92550644fb54f75691d
+checksum=76d3778f0326597ed7505bab19493a9bf6b73a5c5ca614e8fb82f42105c57d00
 
 fplll-devel_package() {
 	depends="${makedepends} ${sourcepkg}>=${version}_${revision}"

From 930ee2ff5eff3f63728f0a5054e0e9515ec00cf7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 16 Oct 2023 17:36:36 -0300
Subject: [PATCH 4/6] python3-fpylll: update to 0.6.0, fix cross-build.

---
 .../patches/cython3-legacy.patch              |  37 ---
 .../python3-fpylll/patches/python312.patch    | 213 ------------------
 srcpkgs/python3-fpylll/template               |  19 +-
 3 files changed, 8 insertions(+), 261 deletions(-)
 delete mode 100644 srcpkgs/python3-fpylll/patches/cython3-legacy.patch
 delete mode 100644 srcpkgs/python3-fpylll/patches/python312.patch

diff --git a/srcpkgs/python3-fpylll/patches/cython3-legacy.patch b/srcpkgs/python3-fpylll/patches/cython3-legacy.patch
deleted file mode 100644
index 808c14e9c1b47..0000000000000
--- a/srcpkgs/python3-fpylll/patches/cython3-legacy.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-commit b6e12c2b0648e84b26dcf0aac507a5b4d9dde301
-Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
-Date:   Wed Jul 19 20:38:01 2023 -0300
-
-    cython3 support using legacy directives
-
-diff --git a/setup.py b/setup.py
-index 274836f..8fc5af5 100755
---- a/setup.py
-+++ b/setup.py
-@@ -123,7 +123,12 @@ class build_ext(_build_ext, object):
-             self.extensions,
-             include_path=["src"],
-             build_dir=self.cythonize_dir,
--            compiler_directives={"binding": True, "embedsignature": True, "language_level": 2},
-+            compiler_directives={
-+                "binding": True,
-+                "embedsignature": True,
-+                "language_level": 2,
-+                "legacy_implicit_noexcept": True,
-+                },
-         )
-         super(build_ext, self).run()
- 
-diff --git a/src/fpylll/fplll/enumeration_callback_helper.h b/src/fpylll/fplll/enumeration_callback_helper.h
-index c099430..706162f 100644
---- a/src/fpylll/fplll/enumeration_callback_helper.h
-+++ b/src/fpylll/fplll/enumeration_callback_helper.h
-@@ -5,7 +5,7 @@
- #include <Python.h>
- #include <fplll/fplll.h>
- 
--extern "C" {
-+extern "C++" {
-   bool evaluator_callback_call_obj(PyObject *obj, int n, double *new_sol_coord);
- }
- 
diff --git a/srcpkgs/python3-fpylll/patches/python312.patch b/srcpkgs/python3-fpylll/patches/python312.patch
deleted file mode 100644
index d2947a0622a36..0000000000000
--- a/srcpkgs/python3-fpylll/patches/python312.patch
+++ /dev/null
@@ -1,213 +0,0 @@
-From 4ed789aac4eeb1c109cbeb4822fac0b5ff76bd37 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 2 Oct 2023 08:59:00 -0300
-Subject: [PATCH] Support python 3.12
-
----
- src/fpylll/gmp/pycore_long.h   | 98 ++++++++++++++++++++++++++++++++++
- src/fpylll/gmp/pycore_long.pxd |  9 ++++
- src/fpylll/gmp/pylong.pxd      | 17 +-----
- src/fpylll/gmp/pylong.pyx      | 22 ++++----
- 4 files changed, 119 insertions(+), 27 deletions(-)
- create mode 100644 src/fpylll/gmp/pycore_long.h
- create mode 100644 src/fpylll/gmp/pycore_long.pxd
-
-diff --git a/src/fpylll/gmp/pycore_long.h b/src/fpylll/gmp/pycore_long.h
-new file mode 100644
-index 00000000..ff1a73d0
---- /dev/null
-+++ b/src/fpylll/gmp/pycore_long.h
-@@ -0,0 +1,98 @@
-+#include "Python.h"
-+#include <stdbool.h>
-+
-+#if PY_VERSION_HEX >= 0x030C00A5
-+#define ob_digit(o)  (((PyLongObject*)o)->long_value.ob_digit)
-+#else
-+#define ob_digit(o)  (((PyLongObject*)o)->ob_digit)
-+#endif
-+
-+#if PY_VERSION_HEX >= 0x030C00A7
-+// taken from cpython:Include/internal/pycore_long.h @ 3.12
-+
-+/* Long value tag bits:
-+ * 0-1: Sign bits value = (1-sign), ie. negative=2, positive=0, zero=1.
-+ * 2: Reserved for immortality bit
-+ * 3+ Unsigned digit count
-+ */
-+#define SIGN_MASK 3
-+#define SIGN_ZERO 1
-+#define SIGN_NEGATIVE 2
-+#define NON_SIZE_BITS 3
-+
-+static inline bool
-+_PyLong_IsZero(const PyLongObject *op)
-+{
-+    return (op->long_value.lv_tag & SIGN_MASK) == SIGN_ZERO;
-+}
-+
-+static inline bool
-+_PyLong_IsNegative(const PyLongObject *op)
-+{
-+    return (op->long_value.lv_tag & SIGN_MASK) == SIGN_NEGATIVE;
-+}
-+
-+static inline bool
-+_PyLong_IsPositive(const PyLongObject *op)
-+{
-+    return (op->long_value.lv_tag & SIGN_MASK) == 0;
-+}
-+
-+static inline Py_ssize_t
-+_PyLong_DigitCount(const PyLongObject *op)
-+{
-+    assert(PyLong_Check(op));
-+    return op->long_value.lv_tag >> NON_SIZE_BITS;
-+}
-+
-+#define TAG_FROM_SIGN_AND_SIZE(sign, size) ((1 - (sign)) | ((size) << NON_SIZE_BITS))
-+
-+static inline void
-+_PyLong_SetSignAndDigitCount(PyLongObject *op, int sign, Py_ssize_t size)
-+{
-+    assert(size >= 0);
-+    assert(-1 <= sign && sign <= 1);
-+    assert(sign != 0 || size == 0);
-+    op->long_value.lv_tag = TAG_FROM_SIGN_AND_SIZE(sign, (size_t)size);
-+}
-+
-+#else
-+// fallback for < 3.12
-+
-+static inline bool
-+_PyLong_IsZero(const PyLongObject *op)
-+{
-+    return Py_SIZE(op) == 0;
-+}
-+
-+static inline bool
-+_PyLong_IsNegative(const PyLongObject *op)
-+{
-+    return Py_SIZE(op) < 0;
-+}
-+
-+static inline bool
-+_PyLong_IsPositive(const PyLongObject *op)
-+{
-+    return Py_SIZE(op) > 0;
-+}
-+
-+static inline Py_ssize_t
-+_PyLong_DigitCount(const PyLongObject *op)
-+{
-+    Py_ssize_t size = Py_SIZE(op);
-+    return size < 0 ? -size : size;
-+}
-+
-+static inline void
-+_PyLong_SetSignAndDigitCount(PyLongObject *op, int sign, Py_ssize_t size)
-+{
-+#if (PY_MAJOR_VERSION == 3) && (PY_MINOR_VERSION < 9)
-+// The function Py_SET_SIZE is defined starting with python 3.9.
-+    Py_SIZE(o) = size;
-+#else
-+    Py_SET_SIZE(op, sign < 0 ? -size : size);
-+#endif
-+}
-+
-+#endif
-diff --git a/src/fpylll/gmp/pycore_long.pxd b/src/fpylll/gmp/pycore_long.pxd
-new file mode 100644
-index 00000000..41de637f
---- /dev/null
-+++ b/src/fpylll/gmp/pycore_long.pxd
-@@ -0,0 +1,9 @@
-+from cpython.longintrepr cimport py_long, digit
-+
-+cdef extern from "pycore_long.h":
-+    digit* ob_digit(py_long o)
-+    bint _PyLong_IsZero(py_long o)
-+    bint _PyLong_IsNegative(py_long o)
-+    bint _PyLong_IsPositive(py_long o)
-+    Py_ssize_t _PyLong_DigitCount(py_long o)
-+    void _PyLong_SetSignAndDigitCount(py_long o, int sign, Py_ssize_t size)
-diff --git a/src/fpylll/gmp/pylong.pxd b/src/fpylll/gmp/pylong.pxd
-index 4ec3f47c..c64bcb6a 100644
---- a/src/fpylll/gmp/pylong.pxd
-+++ b/src/fpylll/gmp/pylong.pxd
-@@ -3,23 +3,10 @@
- Various functions to deal with conversion mpz <-> Python int/long
- """
- 
--cdef extern from "Python.h":
--    cdef _PyLong_New(Py_ssize_t s)
--    cdef long PyLong_SHIFT
--    ctypedef unsigned int digit
--    ctypedef struct PyLongObject:
--        digit* ob_digit
--
--    ctypedef struct PyObject:
--        pass
--
--    ctypedef struct PyVarObject:
--        PyObject ob_base
--        Py_ssize_t ob_size
--
-+from cpython.longintrepr cimport py_long
- from fpylll.gmp.types cimport *
- 
- cdef mpz_get_pylong(mpz_srcptr z)
- cdef mpz_get_pyintlong(mpz_srcptr z)
--cdef int mpz_set_pylong(mpz_ptr z, L) except -1
-+cdef int mpz_set_pylong(mpz_ptr z, py_long L) except -1
- cdef Py_hash_t mpz_pythonhash(mpz_srcptr z)
-diff --git a/src/fpylll/gmp/pylong.pyx b/src/fpylll/gmp/pylong.pyx
-index 4b47146f..885d4efe 100644
---- a/src/fpylll/gmp/pylong.pyx
-+++ b/src/fpylll/gmp/pylong.pyx
-@@ -28,6 +28,9 @@ AUTHORS:
- 
- from cpython.int cimport PyInt_FromLong
- from cpython.long cimport PyLong_CheckExact, PyLong_FromLong
-+from cpython.longintrepr cimport _PyLong_New, digit, PyLong_SHIFT
-+from .pycore_long cimport (ob_digit, _PyLong_IsZero, _PyLong_IsNegative,
-+        _PyLong_IsPositive, _PyLong_DigitCount, _PyLong_SetSignAndDigitCount)
- from .mpz cimport *
- 
- # Unused bits in every PyLong digit
-@@ -40,11 +43,9 @@ cdef mpz_get_pylong_large(mpz_srcptr z):
-     """
-     cdef size_t nbits = mpz_sizeinbase(z, 2)
-     cdef size_t pylong_size = (nbits + PyLong_SHIFT - 1) // PyLong_SHIFT
--    L = _PyLong_New(pylong_size)
--    mpz_export((<PyLongObject*>L).ob_digit, NULL,
--            -1, sizeof(digit), 0, PyLong_nails, z)
--    if mpz_sgn(z) < 0:
--        (<PyVarObject*>L).ob_size = -(<PyVarObject*>L).ob_size
-+    cdef py_long L = _PyLong_New(pylong_size)
-+    mpz_export(ob_digit(L), NULL, -1, sizeof(digit), 0, PyLong_nails, z)
-+    _PyLong_SetSignAndDigitCount(L, mpz_sgn(z), pylong_size)
-     return L
- 
- 
-@@ -67,16 +68,13 @@ cdef mpz_get_pyintlong(mpz_srcptr z):
-     return mpz_get_pylong_large(z)
- 
- 
--cdef int mpz_set_pylong(mpz_ptr z, L) except -1:
-+cdef int mpz_set_pylong(mpz_ptr z, py_long L) except -1:
-     """
-     Convert a Python ``long`` `L` to an ``mpz``.
-     """
--    cdef Py_ssize_t pylong_size = (<PyVarObject*>L).ob_size
--    if pylong_size < 0:
--        pylong_size = -pylong_size
--    mpz_import(z, pylong_size, -1, sizeof(digit), 0, PyLong_nails,
--            (<PyLongObject*>L).ob_digit)
--    if (<PyVarObject*>L).ob_size < 0:
-+    cdef Py_ssize_t pylong_size = _PyLong_DigitCount(L)
-+    mpz_import(z, pylong_size, -1, sizeof(digit), 0, PyLong_nails, ob_digit(L))
-+    if _PyLong_IsNegative(L):
-         mpz_neg(z, z)
- 
- 
diff --git a/srcpkgs/python3-fpylll/template b/srcpkgs/python3-fpylll/template
index adff12e05ae3a..49bfd4ec0262a 100644
--- a/srcpkgs/python3-fpylll/template
+++ b/srcpkgs/python3-fpylll/template
@@ -1,11 +1,11 @@
 # Template file for 'python3-fpylll'
 pkgname=python3-fpylll
-version=0.5.9
-revision=3
-build_style=python3-module
-hostmakedepends="python3-Cython"
-makedepends="python3-cysignals python3-devel gmp-devel mpfr-devel fplll-devel
- pari-devel"
+version=0.6.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-setuptools python3-wheel python3-Cython
+ python3-cysignals"
+makedepends="python3-devel gmp-devel mpfr-devel fplll-devel pari-devel"
 depends="python3"
 checkdepends="python3-pytest python3-numpy"
 short_desc="Python wrapper to fplll (floating point lattice algorithms)"
@@ -14,13 +14,10 @@ license="GPL-2.0-or-later"
 homepage="https://github.com/fplll/fpylll"
 changelog="https://github.com/fplll/fpylll/releases"
 distfiles="${PYPI_SITE}/f/fpylll/fpylll-${version}.tar.gz"
-checksum=be16d40fd94ddea771ccef44434732dfbf9a88cf15cd5f9020ec7a8197f16358
+checksum=623b4619b6da9fed9ba26b1ac7e8d8e620a06d2a5f7095ee67985c7160d3c3a4
+make_check_pre="env PY_IGNORE_IMPORTMISMATCH=1"
 
 case $XBPS_TARGET_MACHINE in
 	# skip a test with numerical noise on 32 bit
 	i686*) make_check_args="-k not(averaged_simulate_prob)" ;;
 esac
-
-pre_check() {
-	export PY_IGNORE_IMPORTMISMATCH=1
-}

From 176773c64a35f98187da069e10d0307f59e48430 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 16 Oct 2023 18:11:02 -0300
Subject: [PATCH 5/6] python3-primecountpy: fix cross-build.

---
 srcpkgs/python3-primecountpy/template | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/python3-primecountpy/template b/srcpkgs/python3-primecountpy/template
index 886e5d67c512a..eb3587dbb29c8 100644
--- a/srcpkgs/python3-primecountpy/template
+++ b/srcpkgs/python3-primecountpy/template
@@ -2,9 +2,10 @@
 pkgname=python3-primecountpy
 version=0.1.0
 revision=4
-build_style=python3-module
-hostmakedepends="python3-setuptools python3-Cython"
-makedepends="python3-cysignals python3-devel primecount-devel pari-devel"
+build_style=python3-pep517
+hostmakedepends="python3-setuptools python3-wheel python3-Cython
+ python3-cysignals"
+makedepends="python3-devel primecount-devel pari-devel"
 depends="python3"
 short_desc="Python interface to the C++ library primecount"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"

From 61be9b9d607c43d74d90081757ce8a3e934257e4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 16 Oct 2023 18:13:34 -0300
Subject: [PATCH 6/6] python3-pplpy: update to 0.8.9, fix cross-build.

---
 .../patches/dont-depend-on-sphinx.patch       |  7 +++++++
 srcpkgs/python3-pplpy/template                | 19 ++++++++++---------
 2 files changed, 17 insertions(+), 9 deletions(-)
 create mode 100644 srcpkgs/python3-pplpy/patches/dont-depend-on-sphinx.patch

diff --git a/srcpkgs/python3-pplpy/patches/dont-depend-on-sphinx.patch b/srcpkgs/python3-pplpy/patches/dont-depend-on-sphinx.patch
new file mode 100644
index 0000000000000..65c5cf40d73bd
--- /dev/null
+++ b/srcpkgs/python3-pplpy/patches/dont-depend-on-sphinx.patch
@@ -0,0 +1,7 @@
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -1,3 +1,3 @@
+ [build-system]
+-requires = ["setuptools", "wheel", "Cython", "cysignals", "sphinx", "gmpy2>=2.1.0b1"]
++requires = ["setuptools", "wheel", "Cython", "cysignals", "gmpy2>=2.1.0b1"]
+ build-backend = "setuptools.build_meta"
diff --git a/srcpkgs/python3-pplpy/template b/srcpkgs/python3-pplpy/template
index fe6b08dba40f2..4a9c987b2a859 100644
--- a/srcpkgs/python3-pplpy/template
+++ b/srcpkgs/python3-pplpy/template
@@ -1,19 +1,20 @@
 # Template file for 'python3-pplpy'
 pkgname=python3-pplpy
-version=0.8.7
-revision=4
-build_style=python3-module
-hostmakedepends="python3-setuptools python3-Cython0.29"
-makedepends="python3-cysignals python3-gmpy2 python3-devel gmp-devel
- gmpxx-devel ppl-devel mpfr-devel libmpc-devel pari-devel"
+version=0.8.9
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-setuptools python3-wheel python3-Cython0.29
+ python3-cysignals python3-gmpy2"
+makedepends="python3-devel gmp-devel gmpxx-devel ppl-devel mpfr-devel
+ libmpc-devel pari-devel"
 depends="python3"
 short_desc="Python wrapper to the C++ Parma Polyhedra Library (PPL)"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
-homepage="https://gitlab.com/videlec/pplpy"
-changelog="https://gitlab.com/videlec/pplpy/-/raw/master/CHANGES.txt"
+homepage="https://github.com/sagemath/pplpy"
+changelog="https://raw.githubusercontent.com/sagemath/pplpy/master/CHANGES.txt"
 distfiles="${PYPI_SITE}/p/pplpy/pplpy-${version}.tar.gz"
-checksum=500bd0f4ae1a76956fae7fcba77854f5ec3e64fce76803664983763c3f2bd8bd
+checksum=db7a3b571d6ef053f75137975e947c3a1c1e45a30bab90eaf215b4e5cc15797e
 
 do_check() {
 	PYTHONPATH=$(cd build/lib* && pwd) python3 setup.py test

  parent reply	other threads:[~2023-10-19  1:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16 22:39 [PR PATCH] " tornaria
2023-10-17 15:18 ` dkwo
2023-10-17 20:39 ` [PR PATCH] [Updated] " tornaria
2023-10-17 20:45 ` tornaria
2023-10-17 20:57 ` [PR REVIEW] " classabbyamp
2023-10-17 23:15 ` tornaria
2023-10-18 22:59 ` [PR PATCH] [Updated] " tornaria
2023-10-19  1:53 ` tornaria [this message]
2023-10-19  1:54 ` tornaria
2023-10-19 11:21 ` tornaria
2023-10-19 11:23 ` [PR PATCH] [Updated] " tornaria
2023-10-20  0:37 ` [PR PATCH] [Merged]: " ahesford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231019015323.fbRRHdT2t57x2-K3Q0C_ZZ6cCPcX61NWQOC4nRg8stw@z \
    --to=tornaria@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).