From 71ecd5d0ba211bb37c77f1704715045b1e327687 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Tue, 20 Aug 2024 12:28:09 +0200 Subject: [PATCH] Add support for phpy (#964) --- data/special-requirements | 1 + data/supported-extensions | 1 + install-php-extensions | 14 +++++++++++++ scripts/tests/phpy | 41 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+) create mode 100755 scripts/tests/phpy diff --git a/data/special-requirements b/data/special-requirements index c3d62bf..f5a98d2 100644 --- a/data/special-requirements +++ b/data/special-requirements @@ -6,6 +6,7 @@ lz4 !jessie memprof !alpine3.9 !alpine3.10 !alpine3.11 !alpine3.12 !alpine3.13 !alpine3.14 !alpine3.15 parallel zts parle !jessie +phpy !buster pthreads zts saxon !alpine simdjson !jessie !stretch diff --git a/data/supported-extensions b/data/supported-extensions index 8114dd9..806d27f 100644 --- a/data/supported-extensions +++ b/data/supported-extensions @@ -82,6 +82,7 @@ pdo_pgsql 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 pdo_sqlsrv 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 pgsql 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 php_trie 7.3 7.4 8.0 8.1 8.2 8.3 8.4 +phpy 8.1 8.2 8.3 8.4 pkcs11 7.4 8.0 8.1 8.2 8.3 8.4 pq 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 propro 5.5 5.6 7.0 7.1 7.2 7.3 7.4 diff --git a/install-php-extensions b/install-php-extensions index 1c63237..2de0b1e 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -1218,6 +1218,20 @@ buildRequiredPackageLists() { php_trie@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++" ;; + phpy@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent python3" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile python3-dev" + ;; + phpy@debian) + if test $DISTRO_VERSION_NUMBER -ge 12; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libpython3.11" + elif test $DISTRO_VERSION_NUMBER -ge 11; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libpython3.9" + else + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libpython3.7" + fi + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile python3-dev" + ;; pkcs11@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent softhsm" ;; diff --git a/scripts/tests/phpy b/scripts/tests/phpy new file mode 100755 index 0000000..7490961 --- /dev/null +++ b/scripts/tests/phpy @@ -0,0 +1,41 @@ +#!/usr/bin/env php +uname(); + $unameType = gettype($uname); + if ($unameType !== 'object') { + throw new RuntimeException("os::uname() should return an object, not {$unameType}"); + } + $unameClass = get_class($uname); + if ($unameClass !== 'PyTuple') { + throw new RuntimeException("os::uname() should return a PyTuple instance, not {$unameClass}"); + } + if ($uname->count() < 5) { + throw new RuntimeException('os::uname() should return a PyTuple with at leasd 5 elements'); + } + $sysname = (string) $uname[0]; + $sysNames = ['Linux']; + if (!in_array($sysname, $sysNames, true)) { + throw new RuntimeException("os::uname()[0] should be '" . implode("' or '", $sysNames) . "', '{$sysname}' received"); + } +} catch (RuntimeException $x) { + fwrite(STDERR, rtrim($x->getMessage()) . "\n"); + exit(1); +} +echo "phpy seems ok.\n";