Skip to content

Commit

Permalink
Add support for phpy (#964)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlocati authored Aug 20, 2024
1 parent caa12a3 commit 71ecd5d
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/special-requirements
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions data/supported-extensions
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions install-php-extensions
Original file line number Diff line number Diff line change
Expand Up @@ -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"
;;
Expand Down
41 changes: 41 additions & 0 deletions scripts/tests/phpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env php
<?php

require_once __DIR__ . '/_bootstrap.php';

try {
$rc = 0;
if (!class_exists('PyCore', false)) {
throw new RuntimeException("PyCore class doesn't exist");
}
$os = PyCore::import('os');
$osType = gettype($os);
if ($osType !== 'object') {
throw new RuntimeException("PyCore::import() should return an object, not {$osType}");
}
$osClass = get_class($os);
if ($osClass !== 'PyModule') {
throw new RuntimeException("PyCore::import() should return a PyModule instance, not {$osClass}");
}
$uname = $os->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";

0 comments on commit 71ecd5d

Please sign in to comment.