[gedit/gnome-2-28] Add support for python plugins



commit 5a6fdd7d2805cec0de21e21267b5a219375d96be
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sun Jan 24 00:51:04 2010 +0100

    Add support for python plugins

 gedit/gedit.c            |   30 ++++++++++++-------------
 win32/build-installer.sh |   53 ++++++++++++++++++---------------------------
 win32/gedit.iss.in       |    3 +-
 3 files changed, 37 insertions(+), 49 deletions(-)
---
diff --git a/gedit/gedit.c b/gedit/gedit.c
index f07d45d..b138ee5 100644
--- a/gedit/gedit.c
+++ b/gedit/gedit.c
@@ -515,28 +515,26 @@ send_bacon_message (void)
 static void
 setup_path (void)
 {
-	/* Set PATH to include the gedit executable's folder */
-	wchar_t exe_filename[MAX_PATH];
-	wchar_t *p;
-	gchar *exe_folder_utf8;
 	gchar *path;
-	
-	GetModuleFileNameW (NULL, exe_filename, G_N_ELEMENTS (exe_filename)); 
-	
-	p = wcsrchr (exe_filename, L'\\');
-	g_assert (p != NULL);
-	
-	*p = L'\0';
-	exe_folder_utf8 = g_utf16_to_utf8 (exe_filename, -1, NULL, NULL, NULL);
-	
+	gchar *installdir;
+	gchar *bin;
+
+	installdir = g_win32_get_package_installation_directory_of_module (NULL);
+
+	bin = g_build_filename (installdir,
+				"bin", NULL);
+	g_free (installdir);
+
+	/* Set PATH to include the gedit executable's folder */
 	path = g_build_path (";",
-			     exe_folder_utf8,
+			     bin,
 			     g_getenv ("PATH"),
 			     NULL);
+	g_free (bin);
+
 	if (!g_setenv ("PATH", path, TRUE))
 		g_warning ("Could not set PATH for gedit");
-	
-	g_free (exe_folder_utf8);
+
 	g_free (path);
 }
 #endif
diff --git a/win32/build-installer.sh b/win32/build-installer.sh
index ec6c99d..a0ebc64 100755
--- a/win32/build-installer.sh
+++ b/win32/build-installer.sh
@@ -1,10 +1,10 @@
 #!/bin/sh
 echo "You need to execute this on a Windows machine within msys (http://www.mingw.org)"
 echo "You also need InnoSetup (http://www.innosetup.org) with iscc in your PATH"
-echo "You need to have python, pygobject, pycairo and pygtk installed into C:\\Python25"
+echo "You need to have python, pygobject, pycairo and pygtk installed into C:\\Python26"
 echo "Make sure gedit and all its dependencies have been installed correctly to /local"
 echo "You can specify the paths by yourself:"
-echo "./build-installer.sh VERSION GTK_PREFIX GEDIT_PREFIX GTKSOURCEVIEW_PREFIX PYTHON_PREFIX MISC_PREFIX ASPELL_PREFIX"
+echo "./build-installer.sh VERSION GTK_PREFIX GEDIT_PREFIX GTKSOURCEVIEW_PREFIX PYTHON_PREFIX MISC_PREFIX ASPELL_PREFIX WINDOWS_PREFIX"
 
 # we assume glib, gtk etc were installed in the root while gedit and gtksourceview
 # in /local
@@ -16,13 +16,15 @@ if test "$#" = 7; then
   _python_prefix="$5"
   _misc_prefix="$6"
   _aspell_prefix="$7"
+  _windows_prefix="$8"
 else
   _gtk_prefix="/c/gtk"
   _gtksourceview_prefix="/usr/local"
   _gedit_prefix="/usr/local"
-  _python_prefix="/c/Python25"
+  _python_prefix="/c/Python26"
   _misc_prefix="/usr"
   _aspell_prefix="/c/Aspell"
+  _windows_prefix="/c/WINDOWS/system32"
 fi
 
 if test "$1" = '--help'; then
@@ -128,47 +130,34 @@ cp "${_misc_prefix}/bin/libxml2-2.dll" installer/gedit/bin || exit
 cp "${_misc_prefix}/bin/intl.dll" installer/gedit/bin || exit
 cp "${_misc_prefix}/bin/iconv.dll" installer/gedit/bin || exit
 
-#FIXME: We have to build with Python
-#echo "Copying Python..."
 
-# TODO: Find out Windows directory somehow, perhaps by looking at PATH?
-#cp /c/WINDOWS/system32/python25.dll installer/bin || exit
+echo "Copying Python..."
 
-# We through all python modules into python/. Glom sets PYTHONPATH accordingly.
-#mkdir -p installer/python || exit
+# TODO: Find out Windows directory somehow, we should use WINDIR substuting c:\?
+cp ${_windows_prefix}/python26.dll installer/gedit/bin || exit
 
-# TODO: Perhaps some scripts need more python modules.
-#cp ${_python_prefix}/Lib/*.py installer/python || exit
+# We through all python modules into python/. gedit sets PYTHONPATH accordingly.
+mkdir -p installer/python || exit
 
-#mkdir -p installer/python/encodings || exit
-#cp ${_python_prefix}/Lib/encodings/*.py installer/python/encodings || exit
+# Copy the dlls needed to run python
+cp -R ${_python_prefix}/DLLs installer/python || exit
 
-#cp ${_python_prefix}/Lib/site-packages/glom.pyd installer/python || exit
-#strip installer/python/glom.pyd || exit
-#cp ${_python_prefix}/Lib/site-packages/gtk-2.0/gda.pyd installer/python || exit
-#strip installer/python/gda.pyd || exit
+# TODO: Perhaps some scripts need more python modules.
+mkdir -p installer/python/Lib || exit
+cp ${_python_prefix}/Lib/*.py installer/python/Lib || exit
 
-#cp ${_python_prefix}/Lib/site-packages/pygtk.py installer/python || exit
-#cp ${_python_prefix}/Lib/site-packages/gtk-2.0/*.pyd installer/python || exit
+mkdir -p installer/python/Lib/encodings || exit
+cp ${_python_prefix}/Lib/encodings/*.py installer/python/Lib/encodings || exit
 
-#mkdir -p installer/python/gobject || exit
-#cp ${_python_prefix}/Lib/site-packages/gtk-2.0/gobject/*.py installer/python/gobject || exit
-#cp ${_python_prefix}/Lib/site-packages/gtk-2.0/gobject/*.pyd installer/python/gobject || exit
+cp -R ${_python_prefix}/Lib/site-packages installer/python/Lib || exit
 
-#mkdir -p installer/python/cairo || exit
-#cp ${_python_prefix}/Lib/site-packages/cairo/*.py installer/python/cairo || exit
-#cp ${_python_prefix}/Lib/site-packages/cairo/*.pyd installer/python/cairo || exit
+cp -R ${_python_prefix}/Lib/xml installer/python/Lib || exit
 
-#mkdir -p installer/python/gtk || exit
-#cp ${_python_prefix}/Lib/site-packages/gtk-2.0/gtk/*.py installer/python/gtk || exit
-#cp ${_python_prefix}/Lib/site-packages/gtk-2.0/gtk/*.pyd installer/python/gtk || exit
+mkdir -p installer/python/Lib/sqlite3 || exit
+cp ${_python_prefix}/Lib/sqlite3/*.py installer/python/Lib/sqlite3 || exit
 
 echo "Copying modules..."
 
-#cp ${_python_prefix}/Lib/site-packages/glom.pyd installer/bin || exit
-#cp ${_python_prefix}/Lib/site-packages/gtk-2.0/gda.pyd installer/bin || exit
-#strip installer/bin/*.pyd || exit
-
 cp "${_gtk_prefix}/bin/gtk-query-immodules-2.0.exe" installer/gtk/bin || exit
 
 mkdir -p installer/gtk/lib/gtk-2.0/2.10.0/engines || exit
diff --git a/win32/gedit.iss.in b/win32/gedit.iss.in
index 4ded6df..2939f18 100644
--- a/win32/gedit.iss.in
+++ b/win32/gedit.iss.in
@@ -15,7 +15,7 @@ LicenseFile=gedit\share\doc\COPYING
 Name: "gtk"; Description: "GTK+ runtime environment"; Types: full compact custom; Flags: fixed
 Name: "main"; Description: "Gedit"; Types: full compact custom; Flags: fixed
 
-; TODO: Add python support and Enable languages separately
+; TODO: Enable languages separately
 Name: "python"; Description: "Python runtime and modules"; Types: full compact custom; Flags: fixed
 Name: "locale"; Description: "Translations"; Types: full compact custom; Flags: fixed
 
@@ -41,6 +41,7 @@ Name: "{userprograms}\{groupname}\Uninstall gedit"; Filename: "{uninstallexe}";
 ; All files
 Source: "gtk\*"; DestDir: "{app}\"; Components: gtk; Flags: recursesubdirs
 Source: "gedit\*"; DestDir: "{app}\"; Components: main; Flags: recursesubdirs
+Source: "python\*"; DestDir: "{app}\python"; Components: python; Flags: recursesubdirs
 Source: "locale\*"; DestDir: "{app}\"; Components: locale; Flags: recursesubdirs
 
 [Run]



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]