From 1d73af62666d73ff374d525286d83c5f05032063 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 20 Aug 2024 12:55:48 +0200 Subject: initial package open https://github.com/swoole/phpy/pull/61 use cxx linker open https://github.com/swoole/phpy/pull/62 add LICENSE open https://github.com/swoole/phpy/issues/63 broken with python 3.6 open https://github.com/swoole/phpy/pull/64 report python version --- .gitignore | 9 + 61.patch | 30 + 64.patch | 31 + LICENSE | 1825 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 4 + PHPINFO | 9 + REFLECTION | 1813 +++++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-phpy.spec | 187 ++++++ 8 files changed, 3908 insertions(+) create mode 100644 .gitignore create mode 100644 61.patch create mode 100644 64.patch create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 PHPINFO create mode 100644 REFLECTION create mode 100644 php-pecl-phpy.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..01f0400 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +clog +package-*.xml +*.tgz +*.tar.bz2 +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/61.patch b/61.patch new file mode 100644 index 0000000..19dca69 --- /dev/null +++ b/61.patch @@ -0,0 +1,30 @@ +From c69b1c59e15402fad6def1a82c97730831af01b0 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 20 Aug 2024 10:30:31 +0200 +Subject: [PATCH] this is a c++ ext, use proper linker command + +--- + config.m4 | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/config.m4 b/config.m4 +index da07656..e63353a 100644 +--- a/config.m4 ++++ b/config.m4 +@@ -48,7 +48,6 @@ if test "$PHP_PHPY" != "no"; then + fi + + PHP_REQUIRE_CXX() +- PHP_ADD_LIBRARY(stdc++, 1, PHPY_SHARED_LIBADD) + + PHP_SUBST(PHPY_SHARED_LIBADD) + +@@ -69,7 +68,7 @@ if test "$PHP_PHPY" != "no"; then + phpy_source_files=$(cd $phpy_source_dir && find src -type f -name "*.cc") + phpy_source_files="phpy.cc $phpy_source_files" + +- PHP_NEW_EXTENSION(phpy, $phpy_source_files , $ext_shared) ++ PHP_NEW_EXTENSION(phpy, $phpy_source_files , $ext_shared,,, cxx) + + AC_MSG_RESULT([$ext_builddir]) + diff --git a/64.patch b/64.patch new file mode 100644 index 0000000..f342d23 --- /dev/null +++ b/64.patch @@ -0,0 +1,31 @@ +From b3159e9d7d6ed9104246f183a3bad07e6cdfe187 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 20 Aug 2024 11:15:45 +0200 +Subject: [PATCH] report extension and python version + +--- + phpy.cc | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/phpy.cc b/phpy.cc +index 0690a0a..20f42b8 100644 +--- a/phpy.cc ++++ b/phpy.cc +@@ -7,6 +7,7 @@ + #include "php.h" + #include "ext/standard/info.h" + #include "php_phpy.h" ++#include + + /* {{{ PHP_RINIT_FUNCTION */ + PHP_RINIT_FUNCTION(phpy) +@@ -31,7 +32,8 @@ PHP_MINFO_FUNCTION(phpy) + php_info_print_table_row(2, "Copyright", "上海识沃网络科技有限公司"); + php_info_print_table_row(2, "Email", "service@swoole.com"); + php_info_print_table_row(2, "Website", "https://www.swoole.com/"); +- php_info_print_table_row(2, "Version", PHP_PHPY_VERSION); ++ php_info_print_table_row(2, "Extension Version", PHP_PHPY_VERSION); ++ php_info_print_table_row(2, "Python Version", PY_VERSION); + php_info_print_table_end(); + } + /* }}} */ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c4e69de --- /dev/null +++ b/LICENSE @@ -0,0 +1,1825 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + phpy/LICENSE at 1.0.6 · swoole/phpy · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ Skip to content + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + +
+ + + + + + + + + +
+
+
+ + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + / + + phpy + + + Public +
+ + +
+ +
+ + +
+
+ +
+
+ + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ +
+
+ +
+ +
+

Footer

+ + + + +
+
+ + + + + © 2024 GitHub, Inc. + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..13af741 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../../../common/Makefile + diff --git a/PHPINFO b/PHPINFO new file mode 100644 index 0000000..bd983cc --- /dev/null +++ b/PHPINFO @@ -0,0 +1,9 @@ + +phpy + +phpy support => enabled +Copyright => 上海识沃网络科技有限公司 +Email => service@swoole.com +Website => https://www.swoole.com/ +Extension Version => 1.0.6 +Python Version => 3.12.4 diff --git a/REFLECTION b/REFLECTION new file mode 100644 index 0000000..2e069be --- /dev/null +++ b/REFLECTION @@ -0,0 +1,1813 @@ +Extension [ extension #87 phpy version 1.0.6 ] { + + - Classes [13] { + Class [ class PyCore ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [12] { + Method [ static public method import ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + - Return [ mixed ] + } + + Method [ static public method eval ] { + + - Parameters [2] { + Parameter #0 [ string $code ] + Parameter #1 [ ?array $globals = null ] + } + - Return [ mixed ] + } + + Method [ static public method int ] { + + - Parameters [1] { + Parameter #0 [ mixed $value ] + } + - Return [ PyObject ] + } + + Method [ static public method float ] { + + - Parameters [1] { + Parameter #0 [ mixed $value ] + } + - Return [ PyObject ] + } + + Method [ static public method bytes ] { + + - Parameters [1] { + Parameter #0 [ mixed $value = null ] + } + - Return [ PyObject ] + } + + Method [ static public method object ] { + + - Parameters [1] { + Parameter #0 [ mixed $value = null ] + } + - Return [ PyObject ] + } + + Method [ static public method fn ] { + + - Parameters [1] { + Parameter #0 [ callable $cb ] + } + - Return [ PyObject ] + } + + Method [ static public method scalar ] { + + - Parameters [1] { + Parameter #0 [ mixed $value ] + } + - Return [ mixed ] + } + + Method [ static public method next ] { + + - Parameters [1] { + Parameter #0 [ PyObject $iter ] + } + - Return [ mixed ] + } + + Method [ static public method fileno ] { + + - Parameters [1] { + Parameter #0 [ $fp ] + } + - Return [ int|false ] + } + + Method [ static public method setOptions ] { + + - Parameters [1] { + Parameter #0 [ array $options ] + } + - Return [ void ] + } + + Method [ static public method __callStatic ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ array $arguments ] + } + - Return [ mixed ] + } + } + + - Properties [0] { + } + + - Methods [0] { + } + } + + Class [ class PyObject implements Stringable, Iterator, Traversable, ArrayAccess, Countable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [16] { + Method [ public method __construct ] { + + - Parameters [1] { + Parameter #0 [ mixed $value = null ] + } + } + + Method [ public method __call ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ array $arguments ] + } + - Return [ mixed ] + } + + Method [ public method __get ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + - Return [ mixed ] + } + + Method [ public method __set ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method __toString ] { + + - Parameters [0] { + } + - Return [ string ] + } + + Method [ public method __invoke ] { + + - Parameters [1] { + Parameter #0 [ mixed ...$arguments ] + } + - Return [ mixed ] + } + + Method [ public method offsetGet ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ mixed ] + } + + Method [ public method offsetSet ] { + + - Parameters [2] { + Parameter #0 [ mixed $offset ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method offsetUnset ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ void ] + } + + Method [ public method offsetExists ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ bool ] + } + + Method [ public method key ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method next ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method rewind ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method valid ] { + + - Parameters [0] { + } + - Return [ bool ] + } + + Method [ public method current ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method count ] { + + - Parameters [0] { + } + - Return [ int ] + } + } + } + + Class [ final class PyStr extends PyObject implements Countable, ArrayAccess, Traversable, Iterator, Stringable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [16] { + Method [ public method __construct ] { + + - Parameters [1] { + Parameter #0 [ mixed $value ] + } + } + + Method [ public method __call ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ array $arguments ] + } + - Return [ mixed ] + } + + Method [ public method __get ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + - Return [ mixed ] + } + + Method [ public method __set ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method __toString ] { + + - Parameters [0] { + } + - Return [ string ] + } + + Method [ public method __invoke ] { + + - Parameters [1] { + Parameter #0 [ mixed ...$arguments ] + } + - Return [ mixed ] + } + + Method [ public method offsetGet ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ mixed ] + } + + Method [ public method offsetSet ] { + + - Parameters [2] { + Parameter #0 [ mixed $offset ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method offsetUnset ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ void ] + } + + Method [ public method offsetExists ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ bool ] + } + + Method [ public method key ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method next ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method rewind ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method valid ] { + + - Parameters [0] { + } + - Return [ bool ] + } + + Method [ public method current ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method count ] { + + - Parameters [0] { + } + - Return [ int ] + } + } + } + + Class [ final class PyModule extends PyObject implements Countable, ArrayAccess, Traversable, Iterator, Stringable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [16] { + Method [ public method __construct ] { + + - Parameters [1] { + Parameter #0 [ mixed $value = null ] + } + } + + Method [ public method __call ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ array $arguments ] + } + - Return [ mixed ] + } + + Method [ public method __get ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + - Return [ mixed ] + } + + Method [ public method __set ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method __toString ] { + + - Parameters [0] { + } + - Return [ string ] + } + + Method [ public method __invoke ] { + + - Parameters [1] { + Parameter #0 [ mixed ...$arguments ] + } + - Return [ mixed ] + } + + Method [ public method offsetGet ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ mixed ] + } + + Method [ public method offsetSet ] { + + - Parameters [2] { + Parameter #0 [ mixed $offset ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method offsetUnset ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ void ] + } + + Method [ public method offsetExists ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ bool ] + } + + Method [ public method key ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method next ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method rewind ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method valid ] { + + - Parameters [0] { + } + - Return [ bool ] + } + + Method [ public method current ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method count ] { + + - Parameters [0] { + } + - Return [ int ] + } + } + } + + Class [ final class PyDict extends PyObject implements Countable, ArrayAccess, Traversable, Iterator, Stringable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [16] { + Method [ public method __construct ] { + + - Parameters [1] { + Parameter #0 [ array $value = null ] + } + } + + Method [ public method offsetGet ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ mixed ] + } + + Method [ public method offsetSet ] { + + - Parameters [2] { + Parameter #0 [ mixed $offset ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method offsetUnset ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ void ] + } + + Method [ public method offsetExists ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ bool ] + } + + Method [ public method key ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method current ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method count ] { + + - Parameters [0] { + } + - Return [ int ] + } + + Method [ public method __call ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ array $arguments ] + } + - Return [ mixed ] + } + + Method [ public method __get ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + - Return [ mixed ] + } + + Method [ public method __set ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method __toString ] { + + - Parameters [0] { + } + - Return [ string ] + } + + Method [ public method __invoke ] { + + - Parameters [1] { + Parameter #0 [ mixed ...$arguments ] + } + - Return [ mixed ] + } + + Method [ public method next ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method rewind ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method valid ] { + + - Parameters [0] { + } + - Return [ bool ] + } + } + } + + Class [ abstract class PySequence extends PyObject implements Countable, ArrayAccess, Traversable, Iterator, Stringable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [18] { + Method [ public method contains ] { + + - Parameters [1] { + Parameter #0 [ mixed $v ] + } + - Return [ bool ] + } + + Method [ public method slice ] { + + - Parameters [2] { + Parameter #0 [ int $s ] + Parameter #1 [ int $e ] + } + - Return [ PyObject ] + } + + Method [ public method __construct ] { + + - Parameters [1] { + Parameter #0 [ mixed $value = null ] + } + } + + Method [ public method __call ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ array $arguments ] + } + - Return [ mixed ] + } + + Method [ public method __get ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + - Return [ mixed ] + } + + Method [ public method __set ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method __toString ] { + + - Parameters [0] { + } + - Return [ string ] + } + + Method [ public method __invoke ] { + + - Parameters [1] { + Parameter #0 [ mixed ...$arguments ] + } + - Return [ mixed ] + } + + Method [ public method offsetGet ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ mixed ] + } + + Method [ public method offsetSet ] { + + - Parameters [2] { + Parameter #0 [ mixed $offset ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method offsetUnset ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ void ] + } + + Method [ public method offsetExists ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ bool ] + } + + Method [ public method key ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method next ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method rewind ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method valid ] { + + - Parameters [0] { + } + - Return [ bool ] + } + + Method [ public method current ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method count ] { + + - Parameters [0] { + } + - Return [ int ] + } + } + } + + Class [ final class PyList extends PySequence implements Stringable, Iterator, Traversable, ArrayAccess, Countable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [18] { + Method [ public method __construct ] { + + - Parameters [1] { + Parameter #0 [ array $value = null ] + } + } + + Method [ public method offsetGet ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ mixed ] + } + + Method [ public method offsetSet ] { + + - Parameters [2] { + Parameter #0 [ mixed $offset ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method offsetUnset ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ void ] + } + + Method [ public method offsetExists ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ bool ] + } + + Method [ public method contains ] { + + - Parameters [1] { + Parameter #0 [ mixed $v ] + } + - Return [ bool ] + } + + Method [ public method slice ] { + + - Parameters [2] { + Parameter #0 [ int $s ] + Parameter #1 [ int $e ] + } + - Return [ PyObject ] + } + + Method [ public method __call ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ array $arguments ] + } + - Return [ mixed ] + } + + Method [ public method __get ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + - Return [ mixed ] + } + + Method [ public method __set ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method __toString ] { + + - Parameters [0] { + } + - Return [ string ] + } + + Method [ public method __invoke ] { + + - Parameters [1] { + Parameter #0 [ mixed ...$arguments ] + } + - Return [ mixed ] + } + + Method [ public method key ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method next ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method rewind ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method valid ] { + + - Parameters [0] { + } + - Return [ bool ] + } + + Method [ public method current ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method count ] { + + - Parameters [0] { + } + - Return [ int ] + } + } + } + + Class [ final class PyTuple extends PySequence implements Stringable, Iterator, Traversable, ArrayAccess, Countable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [18] { + Method [ public method __construct ] { + + - Parameters [1] { + Parameter #0 [ mixed $data ] + } + } + + Method [ public method offsetGet ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ mixed ] + } + + Method [ public method offsetSet ] { + + - Parameters [2] { + Parameter #0 [ mixed $offset ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method offsetUnset ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ void ] + } + + Method [ public method offsetExists ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ bool ] + } + + Method [ public method contains ] { + + - Parameters [1] { + Parameter #0 [ mixed $v ] + } + - Return [ bool ] + } + + Method [ public method slice ] { + + - Parameters [2] { + Parameter #0 [ int $s ] + Parameter #1 [ int $e ] + } + - Return [ PyObject ] + } + + Method [ public method __call ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ array $arguments ] + } + - Return [ mixed ] + } + + Method [ public method __get ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + - Return [ mixed ] + } + + Method [ public method __set ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method __toString ] { + + - Parameters [0] { + } + - Return [ string ] + } + + Method [ public method __invoke ] { + + - Parameters [1] { + Parameter #0 [ mixed ...$arguments ] + } + - Return [ mixed ] + } + + Method [ public method key ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method next ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method rewind ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method valid ] { + + - Parameters [0] { + } + - Return [ bool ] + } + + Method [ public method current ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method count ] { + + - Parameters [0] { + } + - Return [ int ] + } + } + } + + Class [ final class PySet extends PyObject implements Countable, ArrayAccess, Traversable, Iterator, Stringable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [17] { + Method [ public method __construct ] { + + - Parameters [1] { + Parameter #0 [ array $data = null ] + } + } + + Method [ public method count ] { + + - Parameters [0] { + } + - Return [ int ] + } + + Method [ public method contains ] { + + - Parameters [1] { + Parameter #0 [ mixed $v ] + } + - Return [ bool ] + } + + Method [ public method __call ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ array $arguments ] + } + - Return [ mixed ] + } + + Method [ public method __get ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + - Return [ mixed ] + } + + Method [ public method __set ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method __toString ] { + + - Parameters [0] { + } + - Return [ string ] + } + + Method [ public method __invoke ] { + + - Parameters [1] { + Parameter #0 [ mixed ...$arguments ] + } + - Return [ mixed ] + } + + Method [ public method offsetGet ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ mixed ] + } + + Method [ public method offsetSet ] { + + - Parameters [2] { + Parameter #0 [ mixed $offset ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method offsetUnset ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ void ] + } + + Method [ public method offsetExists ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ bool ] + } + + Method [ public method key ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method next ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method rewind ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method valid ] { + + - Parameters [0] { + } + - Return [ bool ] + } + + Method [ public method current ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + } + } + + Class [ final class PyType extends PyObject implements Countable, ArrayAccess, Traversable, Iterator, Stringable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [16] { + Method [ private method __construct ] { + + - Parameters [0] { + } + } + + Method [ public method __call ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ array $arguments ] + } + - Return [ mixed ] + } + + Method [ public method __get ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + - Return [ mixed ] + } + + Method [ public method __set ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method __toString ] { + + - Parameters [0] { + } + - Return [ string ] + } + + Method [ public method __invoke ] { + + - Parameters [1] { + Parameter #0 [ mixed ...$arguments ] + } + - Return [ mixed ] + } + + Method [ public method offsetGet ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ mixed ] + } + + Method [ public method offsetSet ] { + + - Parameters [2] { + Parameter #0 [ mixed $offset ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method offsetUnset ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ void ] + } + + Method [ public method offsetExists ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ bool ] + } + + Method [ public method key ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method next ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method rewind ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method valid ] { + + - Parameters [0] { + } + - Return [ bool ] + } + + Method [ public method current ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method count ] { + + - Parameters [0] { + } + - Return [ int ] + } + } + } + + Class [ final class PyFn extends PyObject implements Countable, ArrayAccess, Traversable, Iterator, Stringable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [16] { + Method [ public method __construct ] { + + - Parameters [1] { + Parameter #0 [ callable $fn ] + } + } + + Method [ public method __call ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ array $arguments ] + } + - Return [ mixed ] + } + + Method [ public method __get ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + - Return [ mixed ] + } + + Method [ public method __set ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method __toString ] { + + - Parameters [0] { + } + - Return [ string ] + } + + Method [ public method __invoke ] { + + - Parameters [1] { + Parameter #0 [ mixed ...$arguments ] + } + - Return [ mixed ] + } + + Method [ public method offsetGet ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ mixed ] + } + + Method [ public method offsetSet ] { + + - Parameters [2] { + Parameter #0 [ mixed $offset ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method offsetUnset ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ void ] + } + + Method [ public method offsetExists ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ bool ] + } + + Method [ public method key ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method next ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method rewind ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method valid ] { + + - Parameters [0] { + } + - Return [ bool ] + } + + Method [ public method current ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method count ] { + + - Parameters [0] { + } + - Return [ int ] + } + } + } + + Class [ final class PyIter extends PyObject implements Countable, ArrayAccess, Traversable, Iterator, Stringable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [16] { + Method [ private method __construct ] { + + - Parameters [0] { + } + } + + Method [ public method __call ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ array $arguments ] + } + - Return [ mixed ] + } + + Method [ public method __get ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + - Return [ mixed ] + } + + Method [ public method __set ] { + + - Parameters [2] { + Parameter #0 [ string $name ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method __toString ] { + + - Parameters [0] { + } + - Return [ string ] + } + + Method [ public method __invoke ] { + + - Parameters [1] { + Parameter #0 [ mixed ...$arguments ] + } + - Return [ mixed ] + } + + Method [ public method offsetGet ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ mixed ] + } + + Method [ public method offsetSet ] { + + - Parameters [2] { + Parameter #0 [ mixed $offset ] + Parameter #1 [ mixed $value ] + } + - Return [ void ] + } + + Method [ public method offsetUnset ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ void ] + } + + Method [ public method offsetExists ] { + + - Parameters [1] { + Parameter #0 [ mixed $offset ] + } + - Return [ bool ] + } + + Method [ public method key ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method next ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method rewind ] { + + - Parameters [0] { + } + - Return [ void ] + } + + Method [ public method valid ] { + + - Parameters [0] { + } + - Return [ bool ] + } + + Method [ public method current ] { + + - Parameters [0] { + } + - Return [ mixed ] + } + + Method [ public method count ] { + + - Parameters [0] { + } + - Return [ int ] + } + } + } + + Class [ final class PyError extends Exception implements Throwable, Stringable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [8] { + Property [ protected $message = '' ] + Property [ protected $code = 0 ] + Property [ protected string $file = '' ] + Property [ protected int $line = 0 ] + Property [ public $error = NULL ] + Property [ public $type = NULL ] + Property [ public $value = NULL ] + Property [ public $traceback = NULL ] + } + + - Methods [10] { + Method [ public method __construct ] { + + - Parameters [3] { + Parameter #0 [ string $message = "" ] + Parameter #1 [ int $code = 0 ] + Parameter #2 [ ?Throwable $previous = null ] + } + } + + Method [ public method __wakeup ] { + + - Parameters [0] { + } + - Tentative return [ void ] + } + + Method [ final public method getMessage ] { + + - Parameters [0] { + } + - Return [ string ] + } + + Method [ final public method getCode ] { + + - Parameters [0] { + } + } + + Method [ final public method getFile ] { + + - Parameters [0] { + } + - Return [ string ] + } + + Method [ final public method getLine ] { + + - Parameters [0] { + } + - Return [ int ] + } + + Method [ final public method getTrace ] { + + - Parameters [0] { + } + - Return [ array ] + } + + Method [ final public method getPrevious ] { + + - Parameters [0] { + } + - Return [ ?Throwable ] + } + + Method [ final public method getTraceAsString ] { + + - Parameters [0] { + } + - Return [ string ] + } + + Method [ public method __toString ] { + + - Parameters [0] { + } + - Return [ string ] + } + } + } + } +} + diff --git a/php-pecl-phpy.spec b/php-pecl-phpy.spec new file mode 100644 index 0000000..4d22a30 --- /dev/null +++ b/php-pecl-phpy.spec @@ -0,0 +1,187 @@ +# remirepo spec file for php-pecl-phpy +# +# Copyright (c) 2024 Remi Collet +# License: CC-BY-SA-4.0 +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# +%if 0%{?scl:1} +%scl_package php-pecl-phpy +%else +%global _root_bindir %{_bindir} +%endif + +%global pecl_name phpy +%global ini_name 40-%{pecl_name}.ini +%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} +%global sources %{pecl_name}-%{version} +%global _configure ../%{sources}/configure + + +Summary: An extension for inter-calling Python and PHP +Name: %{?scl_prefix}php-pecl-%{pecl_name} +Version: 1.0.6 +Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +License: Apache-2.0 +URL: https://pecl.php.net/package/%{pecl_name} +Source0: https://pecl.php.net/get/%{sources}.tgz + +Source1: https://github.com/swoole/phpy/blob/%{version}/LICENSE +Patch0: 61.patch +Patch1: 64.patch + +BuildRequires: make +BuildRequires: %{?dtsprefix}gcc +BuildRequires: %{?scl_prefix}php-devel >= 8.1 +BuildRequires: %{?scl_prefix}php-pear +# See https://github.com/swoole/phpy/issues/63 +BuildRequires: python3-devel >= 3.8 + +Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} +Requires: %{?scl_prefix}php(api) = %{php_core_api} + +Provides: %{?scl_prefix}php-%{pecl_name} = %{version} +Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} +Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} +Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} + + +%description +This extension allows PHP to directly use Python modules and functions without +RPC. Including Pytorch, transformer, numpy, tensorflow and other Python AI +libraries, which can be used like calling PHP functions. + +Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}. + + +%prep +%setup -q -c + +# Don't install/register tests +sed -e 's/role="test"/role="src"/' \ + -e '/README/s/role="src"/role="doc"/' \ + -e '/LICENSE/s/role="doc"/role="src"/' \ + -i package.xml + +cd %{sources} +# drop unneeded options (keep std=c++14) +sed -s '/-Wall/d' -i config.m4 + +# See https://github.com/swoole/phpy/pull/61 +%patch -P0 -p1 -b .pr61 + +# See https://github.com/swoole/phpy/pull/64 +%patch -P1 -p1 -b .pr64 + +# See https://github.com/swoole/phpy/pull/62 +cp %{SOURCE1} . + +# Sanity check, really often broken +extver=$(sed -n '/# define PHP_PHPY_VERSION/{s/.* "//;s/".*$//;p}' php_phpy.h) +if test "x${extver}" != "x%{version}"; then + : Error: Upstream extension version is ${extver}, expecting %{version}. + exit 1 +fi +cd .. + +mkdir NTS +%if %{with_zts} +mkdir ZTS +%endif + +# Create configuration file +cat > %{ini_name} << 'EOF' +; Enable %{pecl_name} extension module +extension=%{pecl_name}.so +EOF + + +%build +%{?dtsenable} + +cd %{sources} +%{__phpize} + +cd ../NTS +%configure \ + --enable-phpy \ + --with-python-config=%{_root_bindir}/python3-config \ + --with-libdir=%{_lib} \ + --with-php-config=%{__phpconfig} +make %{?_smp_mflags} + +%if %{with_zts} +cd ../ZTS +%configure \ + --enable-phpy \ + --with-python-config=%{_root_bindir}/python3-config \ + --with-libdir=%{_lib} \ + --with-php-config=%{__ztsphpconfig} +make %{?_smp_mflags} +%endif + + +%install +%{?dtsenable} + +make -C NTS \ + install INSTALL_ROOT=%{buildroot} + +# install config file +install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} + +# Install XML package description +install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml + +%if %{with_zts} +make -C ZTS \ + install INSTALL_ROOT=%{buildroot} + +install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} +%endif + +# Documentation +for i in LICENSE $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//') +do install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +done + + +%check +cd %{sources} + +# Minimal load test for NTS extension +%{__php} --no-php-ini \ + --define extension=%{buildroot}/%{php_extdir}/%{pecl_name}.so \ + --modules | grep '^%{pecl_name}$' + +%if %{with_zts} +# Minimal load test for ZTS extension +%{__ztsphp} --no-php-ini \ + --define extension=%{buildroot}/%{php_ztsextdir}/%{pecl_name}.so \ + --modules | grep '^%{pecl_name}$' +%endif + + +%files +%license %{sources}/LICENSE +%doc %{pecl_docdir}/%{pecl_name} +%{pecl_xmldir}/%{name}.xml + +%config(noreplace) %{php_inidir}/%{ini_name} +%{php_extdir}/%{pecl_name}.so + +%if %{with_zts} +%config(noreplace) %{php_ztsinidir}/%{ini_name} +%{php_ztsextdir}/%{pecl_name}.so +%endif + + +%changelog +* Tue Aug 20 2024 Remi Collet - 1.0.6-1 +- initial package +- open https://github.com/swoole/phpy/pull/61 use cxx linker +- open https://github.com/swoole/phpy/pull/62 add LICENSE +- open https://github.com/swoole/phpy/issues/63 broken with python 3.6 +- open https://github.com/swoole/phpy/pull/64 report python version + -- cgit