diff --git a/config.w32 b/config.w32 index d05eeae..b3ded34 100644 --- a/config.w32 +++ b/config.w32 @@ -5,11 +5,12 @@ ARG_ENABLE("phpy", "enable phpy extension", "yes"); if (PHP_PHPY != "no") { PYTHONHOME = WshShell.Environment("Process").Item("PYTHONHOME") if (PYTHONHOME) { - ADD_SOURCES("ext/phpy/src/bridge", "core.cc", "phpy") - ADD_SOURCES("ext/phpy/src/php", "object.cc type.cc error.cc iter.cc dict.cc core.cc fn.cc str.cc sequence.cc list.cc set.cc tuple.cc module.cc", "phpy") - ADD_SOURCES("ext/phpy/src/python", "class.cc module.cc object.cc reference.cc resource.cc callable.cc string.cc array.cc", "phpy") + var ext_dir = configure_module_dirname + ADD_SOURCES(ext_dir + "/src/bridge", "core.cc", "phpy") + ADD_SOURCES(ext_dir + "/src/php", "object.cc type.cc error.cc iter.cc dict.cc core.cc fn.cc str.cc sequence.cc list.cc set.cc tuple.cc module.cc", "phpy") + ADD_SOURCES(ext_dir + "/src/python", "class.cc module.cc object.cc reference.cc resource.cc callable.cc string.cc array.cc", "phpy") - EXTENSION("phpy", "phpy.cc", null, '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Iext/phpy/include -Iext/phpy /I ' + PYTHONHOME + '/include') + EXTENSION("phpy", "phpy.cc", null, '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I ' + ext_dir + '/include -I ' + ext_dir + ' /I ' + PYTHONHOME + '/include') ADD_FLAG("CFLAGS", "/D PHP_PHPY_EXPORTS ") ADD_FLAG("LDFLAGS_PHPY", '/libpath:' + PYTHONHOME + '/libs') diff --git a/include/phpy.h b/include/phpy.h index 0811192..d642fdf 100644 --- a/include/phpy.h +++ b/include/phpy.h @@ -20,6 +20,14 @@ #define PY_SSIZE_T_CLEAN #include +#ifdef HAVE_PUTENV +#undef HAVE_PUTENV +#endif + +#ifdef HAVE_GETPID +#undef HAVE_GETPID +#endif + #include
#include
#include
diff --git a/src/php/core.cc b/src/php/core.cc index 2b7ab2f..764e5cc 100644 --- a/src/php/core.cc +++ b/src/php/core.cc @@ -368,10 +368,13 @@ ZEND_METHOD(PyCore, fileno) { RETURN_FALSE; } +#ifndef PHP_WIN32 if (php_stream_is(stream, PHP_STREAM_IS_MEMORY) || php_stream_is(stream, PHP_STREAM_IS_TEMP)) { zend_throw_exception(zend_ce_exception, "Memory and temporary file stream is not supported", 0); RETURN_FALSE; - } else if (php_stream_can_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL) == SUCCESS) { + } else +#endif + if (php_stream_can_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL) == SUCCESS) { if (php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void **) &fd, 1) != SUCCESS || fd < 0) {