summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorberkeviktor@aol.com <berkeviktor@aol.com>2010-08-11 05:49:33 +0200
committerberkeviktor@aol.com <berkeviktor@aol.com>2010-08-11 05:49:33 +0200
commitd099acbaf1525aae135fffcbddca1542c19167d7 (patch)
tree2dd19f40ea4b645b0766ebdaa195f46996a01f09
parentb9ffdc5febfb0835e419ca9c98315a89d8be4258 (diff)
enable the python interface
-rw-r--r--build/build-x64.bat6
-rw-r--r--build/build-x86.bat6
-rw-r--r--build/release-x64.bat2
-rw-r--r--build/release-x86.bat2
-rw-r--r--src/makeinc.mak6
-rw-r--r--xchat-wdk.patch43
6 files changed, 51 insertions, 14 deletions
diff --git a/build/build-x64.bat b/build/build-x64.bat
index bd26f5ad..5c16585c 100644
--- a/build/build-x64.bat
+++ b/build/build-x64.bat
@@ -15,9 +15,9 @@ nmake -f makefile.mak
 cd ..\perl
 nmake -f makefile.mak clean
 nmake -f makefile.mak
-::cd ..\python
-::nmake -f makefile.mak clean
-::nmake -f makefile.mak
+cd ..\python
+nmake -f makefile.mak clean
+nmake -f makefile.mak
 cd ..\tcl
 nmake -f makefile.mak clean
 nmake -f makefile.mak
diff --git a/build/build-x86.bat b/build/build-x86.bat
index 6268b0b8..8e05f21a 100644
--- a/build/build-x86.bat
+++ b/build/build-x86.bat
@@ -15,9 +15,9 @@ nmake -f makefile.mak
 cd ..\perl
 nmake -f makefile.mak clean
 nmake -f makefile.mak
-::cd ..\python
-::nmake -f makefile.mak clean
-::nmake -f makefile.mak
+cd ..\python
+nmake -f makefile.mak clean
+nmake -f makefile.mak
 cd ..\tcl
 nmake -f makefile.mak clean
 nmake -f makefile.mak
diff --git a/build/release-x64.bat b/build/release-x64.bat
index 9787e0ab..0ed7dec6 100644
--- a/build/release-x64.bat
+++ b/build/release-x64.bat
@@ -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\ewc\xcewc.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\xtray\xtray.dll %XCHAT_DEST%\plugins\
 xcopy /S /I ..\po\locale %XCHAT_DEST%\locale
diff --git a/build/release-x86.bat b/build/release-x86.bat
index e64faef3..60df930c 100644
--- a/build/release-x86.bat
+++ b/build/release-x86.bat
@@ -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\ewc\xcewc.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\xtray\xtray.dll %XCHAT_DEST%\plugins\
 xcopy /S /I ..\po\locale %XCHAT_DEST%\locale
diff --git a/src/makeinc.mak b/src/makeinc.mak
index aad61aec..1fa13a76 100644
--- a/src/makeinc.mak
+++ b/src/makeinc.mak
@@ -21,7 +21,7 @@ CPPFLAGS = $(CPPFLAGS) /favor:AMD64 /D_WIN64
 LDFLAGS = $(LDFLAGS) msvcrt_win2003.obj
 
 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
 !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
 
 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
 
 MMX = YES
@@ -43,7 +43,7 @@ MMX = YES
 PERLLIB = perl510
 PERLOUTPUT = xcperl.dll
 
-PYTHONLIB = python25
+PYTHONLIB = python26
 PYTHONOUTPUT = xcpython.dll
 
 TCLLIB = tcl85
diff --git a/xchat-wdk.patch b/xchat-wdk.patch
index 1290f622..ba495afa 100644
--- a/xchat-wdk.patch
+++ b/xchat-wdk.patch
@@ -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
 --- 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 @@
   *
   */
  
-+#define  _INC_DIRENT
++//#define  _INC_DIRENT
  #include <glib.h>
  #include <string.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
  #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.5"	/* Linked to python25.dll */
++#define VERSION "0.8/2.6"	/* Linked to python26.dll */
  #else
  #define VERSION "0.8"
  #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
 --- 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