From 38c39fd847d6880767a38c44b018a9709dd3a17c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20K=C3=B6ppe?= Date: Fri, 26 Jan 2024 21:27:34 -0800 Subject: [PATCH] New packages ppl, pplpy (Parma polyhedra library), cysignals (#4407) --- .devcontainer/onCreate-conda.sh | 3 +- docs/project/changelog.md | 2 + packages/cysignals/meta.yaml | 16 +++++++ ...plementation.c-EMSCRIPTEN-Do-not-use.patch | 38 ++++++++++++++++ packages/cysignals/patches/193.patch | 30 +++++++++++++ packages/libgmp/meta.yaml | 1 + packages/ppl/meta.yaml | 31 +++++++++++++ packages/ppl/patches/clang5-support.patch | 43 +++++++++++++++++++ packages/pplpy/meta.yaml | 27 ++++++++++++ packages/pplpy/test_pplpy.py | 12 ++++++ 10 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 packages/cysignals/meta.yaml create mode 100644 packages/cysignals/patches/0001-src-cysignals-implementation.c-EMSCRIPTEN-Do-not-use.patch create mode 100644 packages/cysignals/patches/193.patch create mode 100644 packages/ppl/meta.yaml create mode 100644 packages/ppl/patches/clang5-support.patch create mode 100644 packages/pplpy/meta.yaml create mode 100644 packages/pplpy/test_pplpy.py diff --git a/.devcontainer/onCreate-conda.sh b/.devcontainer/onCreate-conda.sh index b8167cdc4..4d06577e1 100755 --- a/.devcontainer/onCreate-conda.sh +++ b/.devcontainer/onCreate-conda.sh @@ -5,8 +5,9 @@ set -ex # from https://pyodide.org/en/stable/development/building-from-sources.html#using-make: # - build-essential +# we install file because it is used by packages/ppl during configure # we install pkg-config with apt because it is commented out in environment.yml -sudo apt-get update && sudo apt-get install --yes build-essential pkg-config +sudo apt-get update && sudo apt-get install --yes build-essential file pkg-config conda env create -n pyodide-env -f environment.yml conda init bash diff --git a/docs/project/changelog.md b/docs/project/changelog.md index 0c6b288ac..d8c3a3998 100644 --- a/docs/project/changelog.md +++ b/docs/project/changelog.md @@ -32,6 +32,8 @@ myst: ### Packages +- New Packages: `cysignals`, `ppl`, `pplpy` {pr}`4407` + - Upgraded scikit-learn to 1.4.0 {pr}`4409` ## Version 0.25.0 diff --git a/packages/cysignals/meta.yaml b/packages/cysignals/meta.yaml new file mode 100644 index 000000000..416ba5da0 --- /dev/null +++ b/packages/cysignals/meta.yaml @@ -0,0 +1,16 @@ +package: + name: cysignals + version: 1.11.4 + top-level: + - cysignals +source: + url: https://pypi.io/packages/source/c/cysignals/cysignals-1.11.4.tar.gz + sha256: 0f1e321e55a07f901c86a36a1e4497f6ff9dfe700681d0130a38c36e4eb238c3 + patches: + - patches/193.patch + - patches/0001-src-cysignals-implementation.c-EMSCRIPTEN-Do-not-use.patch +about: + home: https://github.com/sagemath/cysignals + PyPI: https://pypi.org/project/cysignals + summary: Interrupt and signal handling for Cython + license: LGPL v3 diff --git a/packages/cysignals/patches/0001-src-cysignals-implementation.c-EMSCRIPTEN-Do-not-use.patch b/packages/cysignals/patches/0001-src-cysignals-implementation.c-EMSCRIPTEN-Do-not-use.patch new file mode 100644 index 000000000..b89eeca01 --- /dev/null +++ b/packages/cysignals/patches/0001-src-cysignals-implementation.c-EMSCRIPTEN-Do-not-use.patch @@ -0,0 +1,38 @@ +From b13d2be64ff7f855465002cd507cb830de0d43da Mon Sep 17 00:00:00 2001 +From: Matthias Koeppe +Date: Wed, 24 Jan 2024 23:24:45 -0800 +Subject: [PATCH] src/cysignals/implementation.c [EMSCRIPTEN]: Do not use + sigaltstack + +This is https://github.com/sagemath/cysignals/pull/197 + +--- + src/cysignals/implementation.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/cysignals/implementation.c b/src/cysignals/implementation.c +index 2afd6ad..3088cdf 100644 +--- a/src/cysignals/implementation.c ++++ b/src/cysignals/implementation.c +@@ -531,7 +531,7 @@ static void _sig_off_warning(const char* file, int line) + + static void setup_alt_stack(void) + { +-#if HAVE_SIGALTSTACK ++#if HAVE_SIGALTSTACK && !defined(__EMSCRIPTEN__) + /* Space for the alternate signal stack. The size should be + * of the form MINSIGSTKSZ + constant. The constant is chosen rather + * ad hoc but sufficiently large. +@@ -576,7 +576,9 @@ static void setup_cysignals_handlers(void) + * After setting up the trampoline, we reset the signal mask. */ + sigprocmask(SIG_BLOCK, &sa.sa_mask, &default_sigmask); + #endif ++#if !defined(__EMSCRIPTEN__) + setup_trampoline(); ++#endif + #if HAVE_SIGPROCMASK + sigprocmask(SIG_SETMASK, &default_sigmask, &sigmask_with_sigint); + #endif +-- +2.42.0 + diff --git a/packages/cysignals/patches/193.patch b/packages/cysignals/patches/193.patch new file mode 100644 index 000000000..7a18a3383 --- /dev/null +++ b/packages/cysignals/patches/193.patch @@ -0,0 +1,30 @@ +From 474179c87ab0ff562fdfd2471b02797e4bdd3148 Mon Sep 17 00:00:00 2001 +From: Jerome Benoit +Date: Sat, 4 Nov 2023 23:22:30 +0100 +Subject: [PATCH] cythonize: discard now obsoleted directive + +Description: upstream: fix: obsoleted compiler directive: discard + This patch discards the now obsolete compiler directive + `legacy_implicit_noexcept`. +Origin: vendor, Debian +Author: Jerome Benoit +Last-Update: 2023-11-04 + +This is https://github.com/sagemath/cysignals/pull/193 + +--- + setup.py | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/setup.py b/setup.py +index eb9c8f5a..79531705 100755 +--- a/setup.py ++++ b/setup.py +@@ -173,7 +173,6 @@ def cythonize(self, extensions): + compiler_directives=dict( + binding=True, + language_level=2, +- legacy_implicit_noexcept=True, + )) + + diff --git a/packages/libgmp/meta.yaml b/packages/libgmp/meta.yaml index 98fcfd317..8e20ea933 100644 --- a/packages/libgmp/meta.yaml +++ b/packages/libgmp/meta.yaml @@ -16,6 +16,7 @@ build: --host none \ --disable-shared \ --enable-static \ + --enable-cxx \ --prefix=${WASM_LIBRARY_DIR} emmake make -j ${PYODIDE_JOBS:-3} emmake make install diff --git a/packages/ppl/meta.yaml b/packages/ppl/meta.yaml new file mode 100644 index 000000000..7ab8b3157 --- /dev/null +++ b/packages/ppl/meta.yaml @@ -0,0 +1,31 @@ +package: + name: ppl + version: 1.2 + tag: + - library +source: + url: https://www.bugseng.com/products/ppl/download/ftp/releases/1.2/ppl-1.2.tar.xz + sha256: 691f0d5a4fb0e206f4e132fc9132c71d6e33cdda168470d40ac3cf62340e9a60 + patches: + - patches/clang5-support.patch +requirements: + host: + - libgmp + - glpk + +build: + type: static_library + script: | + emconfigure ./configure \ + CFLAGS="-fPIC -Wno-reserved-identifier -Wno-reserved-macro-identifier" \ + CPPFLAGS="-I${WASM_LIBRARY_DIR}/include" \ + CXXFLAGS="-std=c++11 -fPIC -Wno-reserved-identifier -Wno-zero-as-null-pointer-constant -Wno-double-promotion -Wno-unsafe-buffer-usage -Wno-extra-semi-stmt -Wno-shadow -Wno-implicit-fallthrough -Wno-deprecated-literal-operator -Wno-suggest-override -Wno-suggest-destructor-override -Wno-deprecated-copy-with-user-provided-dtor -Wno-deprecated-copy-with-user-provided-copy -Wno-unused-template -Wno-comma -Wno-unreachable-code-return -Wno-deprecated-declarations -Wno-unreachable-code-break -Wno-format-nonliteral -Wno-missing-variable-declarations -Wno-missing-prototypes -Wno-weak-vtables -Wno-old-style-cast -Wno-header-hygiene -Wno-undef" \ + LDFLAGS="-L${WASM_LIBRARY_DIR}/lib" \ + --disable-dependency-tracking \ + --enable-coefficients=mpz --disable-fpmath \ + --enable-interfaces=c,c++ \ + --disable-shared \ + --with-gmp="${WASM_LIBRARY_DIR}" \ + --prefix=${WASM_LIBRARY_DIR} + emmake make -j ${PYODIDE_JOBS:-3} + emmake make install diff --git a/packages/ppl/patches/clang5-support.patch b/packages/ppl/patches/clang5-support.patch new file mode 100644 index 000000000..e2b3bf736 --- /dev/null +++ b/packages/ppl/patches/clang5-support.patch @@ -0,0 +1,43 @@ +From: Roberto Bagnara +Date: Sun, 11 Feb 2018 08:11:09 +0000 (+0100) +Subject: Added missing "template" and "typename" keywords. +X-Git-Url: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl%2Fppl.git;a=commitdiff_plain;h=c39f6a07b51f89e365b05ba4147aa2aa448febd7;hp=3a5e1e20a94cffb830182f22132b153d6691b7c5 + +Added missing "template" and "typename" keywords. +(Thanks to Dmitrii Pasechnik.) + + +This version of PPL, 1.2, is unfortunately the latest upstream version - https://repology.org/project/ppl/versions +For the packages that I'm adding, I am using the patches carried by the SageMath distribution - see https://github.com/sagemath/sage/tree/develop/build/pkgs/ppl + + +--- + +diff --git a/src/Determinate_inlines.hh b/src/Determinate_inlines.hh +index 2749953..5b47275 100644 +--- a/src/Determinate_inlines.hh ++++ b/src/Determinate_inlines.hh +@@ -289,8 +289,8 @@ operator()(Determinate& x, const Determinate& y) const { + + template + template +-inline +-Determinate::Binary_Operator_Assign_Lifter ++inline typename ++Determinate::template Binary_Operator_Assign_Lifter + Determinate::lift_op_assign(Binary_Operator_Assign op_assign) { + return Binary_Operator_Assign_Lifter(op_assign); + } +diff --git a/src/OR_Matrix_inlines.hh b/src/OR_Matrix_inlines.hh +index b20b697..8124b7f 100644 +--- a/src/OR_Matrix_inlines.hh ++++ b/src/OR_Matrix_inlines.hh +@@ -97,7 +97,7 @@ OR_Matrix::Pseudo_Row::Pseudo_Row(const Pseudo_Row& y) + + template + template +-inline OR_Matrix::Pseudo_Row& ++inline typename OR_Matrix::template Pseudo_Row& + OR_Matrix::Pseudo_Row::operator=(const Pseudo_Row& y) { + first = y.first; + #if PPL_OR_MATRIX_EXTRA_DEBUG diff --git a/packages/pplpy/meta.yaml b/packages/pplpy/meta.yaml new file mode 100644 index 000000000..eca0b849d --- /dev/null +++ b/packages/pplpy/meta.yaml @@ -0,0 +1,27 @@ +package: + name: pplpy + version: 0.8.9 + top-level: + - ppl +source: + url: https://files.pythonhosted.org/packages/72/a6/8f5ff229ee82cec9d1e7d2507e6eba492350faf50ae41beb76ef0a7f34a7/pplpy-0.8.9.tar.gz + sha256: db7a3b571d6ef053f75137975e947c3a1c1e45a30bab90eaf215b4e5cc15797e +requirements: + host: + - libgmp + - ppl + - gmpy2 + run: + - gmpy2 + - cysignals +build: + cxxflags: | + -std=c++11 + -I$(WASM_LIBRARY_DIR)/include + ldflags: | + -L$(WASM_LIBRARY_DIR)/lib +about: + home: https://github.com/sagemath/pplpy + PyPI: https://pypi.org/project/pplpy + summary: Python PPL wrapper + license: GPL v3 diff --git a/packages/pplpy/test_pplpy.py b/packages/pplpy/test_pplpy.py new file mode 100644 index 000000000..f82f8da18 --- /dev/null +++ b/packages/pplpy/test_pplpy.py @@ -0,0 +1,12 @@ +from pytest_pyodide import run_in_pyodide + + +@run_in_pyodide(packages=["pplpy"]) +def test_pplpy(selenium): + from ppl import Constraint, Variable + + x = Variable(0) + y = Variable(1) + c = x + 3 * y == 1 + cc = Constraint(c) + assert c.is_equivalent_to(cc)