The attached patches fix bug 2193, just reported, but raised originally by
Uwe on 7 December. See thread
http://thread.gmane.org/gmane.editors.lyx.devel/50473

(instant preview fails if the path to the ghostscript executable contains
spaces.)

I guess the fix fell below the radar screen...

Anyway, the patch is obvious and works for me, so I'll just commit it.

-- 
Angus
Index: status.13x
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/Attic/status.13x,v
retrieving revision 1.1.2.282
diff -u -p -r1.1.2.282 status.13x
--- status.13x	12 Dec 2005 10:08:37 -0000	1.1.2.282
+++ status.13x	5 Jan 2006 14:02:13 -0000
@@ -69,6 +69,9 @@ What's new
 - On exit, don't attempt to unlock a mutex in the Qt library --- it
   causes undefined behaviour and leads to a crash on NetBSD.
 
+- Enable Instant Preview to work if the path to the external GhostScript
+  executable contains spaces. (bug 2193).
+
 * Configuration/Installation:
 
 - Enable TeXFiles.sh to run when its path contains spaces.
Index: lib/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v
retrieving revision 1.363.2.134
diff -u -p -r1.363.2.134 ChangeLog
--- lib/ChangeLog	19 Dec 2005 11:08:08 -0000	1.363.2.134
+++ lib/ChangeLog	5 Jan 2006 14:02:16 -0000
@@ -1,3 +1,9 @@
+2006-01-05  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* scripts/lyxpreview2ppm.py (find_exe): return only the basename of
+	the executable to avoid problems when the path to the exe contains
+	spaces. Fixes bug 2193.
+
 2005-12-16  Georg Baum  <[EMAIL PROTECTED]>
 
 	* symbols: avoid use of symbol font if cmsy is available.
Index: lib/scripts/lyxpreview2ppm.py
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/scripts/Attic/lyxpreview2ppm.py,v
retrieving revision 1.1.2.7
diff -u -p -r1.1.2.7 lyxpreview2ppm.py
--- lib/scripts/lyxpreview2ppm.py	16 Jun 2005 13:15:11 -0000	1.1.2.7
+++ lib/scripts/lyxpreview2ppm.py	5 Jan 2006 14:02:17 -0000
@@ -93,7 +93,11 @@ def find_exe(candidates, path):
                 full_path = os.path.join(directory, prog)
 
             if os.access(full_path, os.X_OK):
-                return full_path
+                # The thing is in the PATH already (or we wouldn't
+                # have found it). Return just the basename to avoid
+                # problems when the path to the executable contains
+                # spaces.
+                return os.path.basename(full_path)
 
     return None
 
Index: lib/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v
retrieving revision 1.752
diff -u -p -r1.752 ChangeLog
--- lib/ChangeLog	2 Jan 2006 19:15:25 -0000	1.752
+++ lib/ChangeLog	5 Jan 2006 14:04:44 -0000
@@ -1,3 +1,9 @@
+2006-01-05  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* scripts/lyxpreview_tools.py (find_exe): return only the basename of
+	the executable to avoid problems when the path to the exe contains
+	spaces. Fixes bug 2193.
+
 2006-01-02  Michael Gerz  <[EMAIL PROTECTED]>
 
 	* layouts/amsart-seq.layout: fix typo in counter
Index: lib/scripts/lyxpreview_tools.py
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/scripts/lyxpreview_tools.py,v
retrieving revision 1.1
diff -u -p -r1.1 lyxpreview_tools.py
--- lib/scripts/lyxpreview_tools.py	9 Aug 2004 11:31:18 -0000	1.1
+++ lib/scripts/lyxpreview_tools.py	5 Jan 2006 14:04:44 -0000
@@ -52,7 +52,11 @@ def find_exe(candidates, path):
                 full_path = os.path.join(directory, prog)
 
             if os.access(full_path, os.X_OK):
-                return full_path
+                # The thing is in the PATH already (or we wouldn't
+                # have found it). Return just the basename to avoid
+                # problems when the path to the executable contains
+                # spaces.
+                return os.path.basename(full_path)
 
     return None
 

Reply via email to