1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-11-25 18:52:22 -05:00

enable the python interface

This commit is contained in:
berkeviktor@aol.com 2010-08-11 05:49:33 +02:00
parent b9ffdc5feb
commit d099acbaf1
6 changed files with 51 additions and 14 deletions

View File

@ -15,9 +15,9 @@ nmake -f makefile.mak
cd ..\perl cd ..\perl
nmake -f makefile.mak clean nmake -f makefile.mak clean
nmake -f makefile.mak nmake -f makefile.mak
::cd ..\python cd ..\python
::nmake -f makefile.mak clean nmake -f makefile.mak clean
::nmake -f makefile.mak nmake -f makefile.mak
cd ..\tcl cd ..\tcl
nmake -f makefile.mak clean nmake -f makefile.mak clean
nmake -f makefile.mak nmake -f makefile.mak

View File

@ -15,9 +15,9 @@ nmake -f makefile.mak
cd ..\perl cd ..\perl
nmake -f makefile.mak clean nmake -f makefile.mak clean
nmake -f makefile.mak nmake -f makefile.mak
::cd ..\python cd ..\python
::nmake -f makefile.mak clean nmake -f makefile.mak clean
::nmake -f makefile.mak nmake -f makefile.mak
cd ..\tcl cd ..\tcl
nmake -f makefile.mak clean nmake -f makefile.mak clean
nmake -f makefile.mak nmake -f makefile.mak

View File

@ -36,7 +36,7 @@ xcopy %SSL_BIN%\ssleay32.dll %XCHAT_DEST%
::xcopy /S /I ..\plugins\dns\xcdns.dll %XCHAT_DEST%\plugins\ ::xcopy /S /I ..\plugins\dns\xcdns.dll %XCHAT_DEST%\plugins\
xcopy /S /I ..\plugins\ewc\xcewc.dll %XCHAT_DEST%\plugins\ xcopy /S /I ..\plugins\ewc\xcewc.dll %XCHAT_DEST%\plugins\
xcopy /S /I ..\plugins\perl\xcperl.dll %XCHAT_DEST%\plugins\ xcopy /S /I ..\plugins\perl\xcperl.dll %XCHAT_DEST%\plugins\
::xcopy /S /I ..\plugins\python\xcpython.dll %XCHAT_DEST%\plugins\ xcopy /S /I ..\plugins\python\xcpython.dll %XCHAT_DEST%\plugins\
xcopy /S /I ..\plugins\tcl\xctcl.dll %XCHAT_DEST%\plugins\ xcopy /S /I ..\plugins\tcl\xctcl.dll %XCHAT_DEST%\plugins\
::xcopy /S /I ..\plugins\xtray\xtray.dll %XCHAT_DEST%\plugins\ ::xcopy /S /I ..\plugins\xtray\xtray.dll %XCHAT_DEST%\plugins\
xcopy /S /I ..\po\locale %XCHAT_DEST%\locale xcopy /S /I ..\po\locale %XCHAT_DEST%\locale

View File

@ -36,7 +36,7 @@ xcopy %SSL_BIN%\ssleay32.dll %XCHAT_DEST%
::xcopy /S /I ..\plugins\dns\xcdns.dll %XCHAT_DEST%\plugins\ ::xcopy /S /I ..\plugins\dns\xcdns.dll %XCHAT_DEST%\plugins\
xcopy /S /I ..\plugins\ewc\xcewc.dll %XCHAT_DEST%\plugins\ xcopy /S /I ..\plugins\ewc\xcewc.dll %XCHAT_DEST%\plugins\
xcopy /S /I ..\plugins\perl\xcperl.dll %XCHAT_DEST%\plugins\ xcopy /S /I ..\plugins\perl\xcperl.dll %XCHAT_DEST%\plugins\
::xcopy /S /I ..\plugins\python\xcpython.dll %XCHAT_DEST%\plugins\ xcopy /S /I ..\plugins\python\xcpython.dll %XCHAT_DEST%\plugins\
xcopy /S /I ..\plugins\tcl\xctcl.dll %XCHAT_DEST%\plugins\ xcopy /S /I ..\plugins\tcl\xctcl.dll %XCHAT_DEST%\plugins\
::xcopy /S /I ..\plugins\xtray\xtray.dll %XCHAT_DEST%\plugins\ ::xcopy /S /I ..\plugins\xtray\xtray.dll %XCHAT_DEST%\plugins\
xcopy /S /I ..\po\locale %XCHAT_DEST%\locale xcopy /S /I ..\po\locale %XCHAT_DEST%\locale

View File

@ -21,7 +21,7 @@ CPPFLAGS = $(CPPFLAGS) /favor:AMD64 /D_WIN64
LDFLAGS = $(LDFLAGS) msvcrt_win2003.obj LDFLAGS = $(LDFLAGS) msvcrt_win2003.obj
PERLPATH = c:\mozilla-build\perl-5.10-x64\lib\CORE PERLPATH = c:\mozilla-build\perl-5.10-x64\lib\CORE
PYTHONPATH = c:\mozilla-build\python-2.5-x64 PYTHONPATH = c:\mozilla-build\python-2.6-x64
TCLPATH = c:\mozilla-build\tcl-8.5-x64 TCLPATH = c:\mozilla-build\tcl-8.5-x64
!else !else
############################################################# #############################################################
@ -33,7 +33,7 @@ LIBS = $(LIBS) /libpath:c:/mozilla-build/build/xchat-dev32/lib gtk-win32-2.0.lib
LDFLAGS = $(LDFLAGS) msvcrt_winxp.obj LDFLAGS = $(LDFLAGS) msvcrt_winxp.obj
PERLPATH = c:\mozilla-build\perl-5.10-x86\lib\CORE PERLPATH = c:\mozilla-build\perl-5.10-x86\lib\CORE
PYTHONPATH = c:\mozilla-build\python-2.5-x86 PYTHONPATH = c:\mozilla-build\python-2.6-x86
TCLPATH = c:\mozilla-build\tcl-8.5-x86 TCLPATH = c:\mozilla-build\tcl-8.5-x86
MMX = YES MMX = YES
@ -43,7 +43,7 @@ MMX = YES
PERLLIB = perl510 PERLLIB = perl510
PERLOUTPUT = xcperl.dll PERLOUTPUT = xcperl.dll
PYTHONLIB = python25 PYTHONLIB = python26
PYTHONOUTPUT = xcpython.dll PYTHONOUTPUT = xcpython.dll
TCLLIB = tcl85 TCLLIB = tcl85

View File

@ -38,12 +38,12 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/perl/perl.c xchat-wdk/plugi
} }
diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/python/python.c xchat-wdk/plugins/python/python.c diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/python/python.c xchat-wdk/plugins/python/python.c
--- xchat-wdk.orig/plugins/python/python.c 2010-05-16 06:31:54 +0200 --- xchat-wdk.orig/plugins/python/python.c 2010-05-16 06:31:54 +0200
+++ xchat-wdk/plugins/python/python.c 2010-08-11 02:11:25 +0200 +++ xchat-wdk/plugins/python/python.c 2010-08-11 05:46:52 +0200
@@ -51,12 +51,13 @@ @@ -51,12 +51,13 @@
* *
*/ */
+#define _INC_DIRENT +//#define _INC_DIRENT
#include <glib.h> #include <glib.h>
#include <string.h> #include <string.h>
-#include <unistd.h> -#include <unistd.h>
@ -60,10 +60,47 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/python/python.c xchat-wdk/p
#ifdef WIN32 #ifdef WIN32
#undef WITH_THREAD /* Thread support locks up xchat on Win32. */ #undef WITH_THREAD /* Thread support locks up xchat on Win32. */
-#define VERSION "0.8/2.4" /* Linked to python24.dll */ -#define VERSION "0.8/2.4" /* Linked to python24.dll */
+#define VERSION "0.8/2.5" /* Linked to python25.dll */ +#define VERSION "0.8/2.6" /* Linked to python26.dll */
#else #else
#define VERSION "0.8" #define VERSION "0.8"
#endif #endif
@@ -1161,6 +1162,27 @@
PyObject_SetAttrString(m, "__version__", o);
if (filename) {
+#ifdef WIN32
+ /* more info:
+ * http://bytes.com/topic/python/answers/840542-pyrun_simplefile-crashes#post3364174
+ * http://effbot.org/pyfaq/pyrun-simplefile-crashes-on-windows-but-not-on-unix-why.htm
+ */
+ PyObject* PyFileObject = PyFile_FromString(filename, "r");
+ if (PyFileObject == NULL) {
+ xchat_printf(ph, "Can't open file %s: %s\n",
+ filename, strerror(errno));
+ goto error;
+ }
+
+ if (PyRun_SimpleFile(PyFile_AsFile(PyFileObject), filename) != 0) {
+ xchat_printf(ph, "Error loading module %s\n",
+ filename);
+ goto error;
+ }
+
+ plugin->filename = filename;
+ filename = NULL;
+#else
FILE *fp;
plugin->filename = filename;
@@ -1184,7 +1206,7 @@
goto error;
}
fclose(fp);
-
+#endif
m = PyDict_GetItemString(PyImport_GetModuleDict(),
"__main__");
if (m == NULL) {
diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/tcl/tclplugin.c xchat-wdk/plugins/tcl/tclplugin.c diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/tcl/tclplugin.c xchat-wdk/plugins/tcl/tclplugin.c
--- xchat-wdk.orig/plugins/tcl/tclplugin.c 2010-03-21 01:49:42 +0100 --- xchat-wdk.orig/plugins/tcl/tclplugin.c 2010-03-21 01:49:42 +0100
+++ xchat-wdk/plugins/tcl/tclplugin.c 2010-08-10 16:29:30 +0200 +++ xchat-wdk/plugins/tcl/tclplugin.c 2010-08-10 16:29:30 +0200