]> git.lyx.org Git - features.git/commitdiff
make LyX work better when run from a directory which name contains spaces or other...
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 14 Sep 2004 10:20:38 +0000 (10:20 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 14 Sep 2004 10:20:38 +0000 (10:20 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8982 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ChangeLog
lib/chkconfig.ltx
lib/configure.m4
src/ChangeLog
src/frontends/qt2/ChangeLog
src/frontends/qt2/qfont_loader.C
src/lyx_cb.C
src/support/ChangeLog
src/support/filetools.C

index 1b903fe08857a59e71d6dbc42907b5cf5b472182..8fcb93ef9203f0e2a4fbe8f05e1142f8959f01da 100644 (file)
@@ -1,3 +1,16 @@
+2004-09-07  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * configure.m4: instead of \input-ing the layout files directly in
+       latex, grep out the correct command from them; remove need for
+       \srcdir. This should fix the bug where latex configuration cannot
+       be done because LyX is installed in a directory which name
+       contains spaces.
+
+       * chkconfig.ltx: remove use of macro \srcdir 
+       (\TestDocClass): change to take two arguments
+       (\DeclareLaTeXClass, \DeclareLinuxDocClass, \DeclareDocBookClass):
+       do not exit after execution
+
 2004-09-13  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
        * languages: add nynorsk
index 3e992653cf433e0d6833a9343ce41fe2673562d6..296188a5a56ebeb2ea45fa8b011e34cf7f874d37 100644 (file)
 
 % we do not want to stop on errors
 \nonstopmode\makeatletter
-% Have we been called from the configure script?
-\@ifundefined{srcdir}
- {\message{%
-**** WARNING: For proper results, you should not run this script directly.^^J%
-**** Please use the `configure' script.^^J}
-  \newcommand\srcdir{.}}
- {\def\input@path{{\srcdir/}}}
 
 %%% Some useful macros.
 %   Several commands are defined to test for packages:
 %    \AddLayout{<layout>} adds an entry for <layout> in textclass.lst
 %    \AddVariable{<name>}{<value>} creates a new variable chk_<name>,
 %      and gives it the value <value>.
-%    \TestDocClass[<file>]{<name>} tests whether <name>.cls (or <file>,
-%      if it is provided) exists and creates a new entry with
-%      \AddLayout if this is the case. Note that you will probably not
-%      need to use this directly, since the configure script generates
-%      the needed macro calls automatically.
+%    \TestDocClass{<name>}{<command>} if layout <name> has not already
+%      been tested for, execute <command>. Note that you will
+%      probably not need to use this directly, since the configure
+%      script generates the needed macro calls automatically.
 %    \TestPackage[<file>]{<name>} tests whether <name>.sty (or <file>,
 %      if it is provided) exists.
 %   Both commands call \AddVariable to give value 'yes' or 'no' to
   \fi}
 \newcommand{\TestPackage}[2][\default]{
   \TestItem[#1]{#2}{package}{sty}{\AddPackage{#2}}{}}
-\newcommand{\TestDocClass}[1]{
+\newcommand{\TestDocClass}[2]{
    \def\layoutname{#1}  % remember the name of the layout file
    \@ifundefined{layout@#1}
-     {\bgroup
-        \catcode`\#=9  % consider # as a space
-        \input{layouts/#1.layout}  % read the layout file
-      \egroup
+     {#2  % execute the command
       \global\@namedef{layout@#1}{}}
      {} % we have already tried this one.
 }
   \TestItem[#1]{\layoutname}{document class}{cls}
            {\AddLayout[\firstelement]{\layoutname}{#2}{true}}
            {\AddLayout[\firstelement]{\layoutname}{#2}{false}}
-  \expandafter\endinput
 }
 \newcommand{\DeclareLinuxDocClass}[2][\default]{
   \message{^^J\prefix checking for linuxdoc class \layoutname... }
      \AddLayout[#1]{\layoutname}{#2}{false}}
     {\message{yes^^J}
      \AddLayout[#1]{\layoutname}{#2}{true}}
-  \expandafter\endinput
 }
 % Only for compatibility. Will be removed later.
 \let\DeclareSGMLClass=\DeclareDocBookClass
      \AddLayout[#1]{\layoutname}{#2}{false}}
     {\message{yes^^J}
      \AddLayout[#1]{\layoutname}{#2}{true}}
-  \expandafter\endinput
 }
 
 % Stolen from article.cls
index 4b0d3584303d6ea5a7c902d0e7829e049b602207..b68cee868ca844f7dc6c86993f11c29696eb4abf 100644 (file)
@@ -167,8 +167,8 @@ ac_prog=[$]0
 changequote(,)dnl
 srcdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
 srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-test "x$srcdir" = "x$ac_prog" && srcdir=.
-if test ! -r ${srcdir}/chkconfig.ltx ; then
+test "x${srcdir}" = "x$ac_prog" && srcdir=.
+if test ! -r "${srcdir}"/chkconfig.ltx ; then
   echo "configure: error: cannot find chkconfig.ltx script"
   exit 1
 fi
@@ -426,9 +426,9 @@ if test ${lyx_check_config} = no ; then
 # for some reason. Run ./configure if you need to update it after a
 # configuration change.
 EOF
-  # build the list of available layout files and convert it to commands
-  # for chkconfig.ltx
-  for file in ./layouts/*.layout ${srcdir}/layouts/*.layout ; do
+  # build the list of available layout files and convert it to entries
+  # for the default textclass.lst file
+  for file in ./layouts/*.layout "${srcdir}"/layouts/*.layout ; do
     case $file in
       */\*.layout) ;;
       *) if test -r "$file" ; then
@@ -464,26 +464,34 @@ changequote(,)dnl
 else
   MSG_RESULT(auto)
   rm -f wrap_chkconfig.ltx chkconfig.vars chkconfig.classes chklayouts.tex
+  if ! test -r "chkconfig.ltx" ; then
+    ln -s "${srcdir}"/chkconfig.ltx .
+    rmlink=true
+  fi
   cat >wrap_chkconfig.ltx <<EOF
-\\newcommand\\srcdir{${srcdir}}
 ${linuxdoc_cmd}
 ${docbook_cmd}
-\\input{${srcdir}/chkconfig.ltx}
+\\input{chkconfig.ltx}
 EOF
   ## Construct the list of classes to test for.
   # build the list of available layout files and convert it to commands
   # for chkconfig.ltx
-  for file in ./layouts/*.layout ${srcdir}/layouts/*.layout ; do
+  for file in ./layouts/*.layout "${srcdir}"/layouts/*.layout ; do
     case $file in
       */\*.layout) ;;
-      *) test -r "$file" && echo $file ;;
+      *) if test -r "$file" ; then 
+           class=`echo $file | sed -e 's%^.*layouts/\(.*\)\.layout$%\1%'`
+          # Generate the proper TestDocClass command for this layout
+          grep '\\Declare\(LaTeX\|DocBook\|LinuxDoc\)Class' "$file" \
+             | sed -e 's/^\# *\(.*\)$/\\TestDocClass{'${class}'}{\1}/' 
+        fi ;;
     esac
-  done | sed -e 's%^.*layouts/\(.*\)\.layout$%\\TestDocClass{\1}%'\
-            > chklayouts.tex
+  done > chklayouts.tex
 changequote([,])dnl
   [eval] ${LATEX} wrap_chkconfig.ltx 2>/dev/null | grep '^\+'
   [eval] `cat chkconfig.vars | sed 's/-/_/g'`
 changequote(,)dnl
+  test -n "${rmlink}" && rm -f chkconfig.ltx
 fi
 
 # Do we have all the files we need? Useful if latex did not run
@@ -503,7 +511,7 @@ changequote(,)dnl
 echo "creating doc/LaTeXConfig.lyx"
 echo "s/@chk_linuxdoc@/$chk_linuxdoc/g" >> chkconfig.sed
 echo "s/@chk_docbook@/$chk_docbook/g" >> chkconfig.sed
-sed -f chkconfig.sed ${srcdir}/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx
+sed -f chkconfig.sed "${srcdir}"/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx
 
 echo "creating $outfile"
 cat >$outfile <<EOF
@@ -673,7 +681,7 @@ for file in $outfile textclass.lst packages.lst \
            doc/LaTeXConfig.lyx xfonts/fonts.dir ; do
   # we rename the file first, so that we avoid comparing a file with itself
   mv $file $file.new
-  if test -r $srcdir/$file && diff $file.new $srcdir/$file >/dev/null 2>/dev/null ;
+  if test -r "${srcdir}"/$file && diff $file.new "${srcdir}"/$file >/dev/null 2>/dev/null ;
   then
     echo "removing $file, which is identical to the system global version"
     rm -f $file.new
index ed860f8eb78bc075f926c39d6a4f4abbdfe570a4..ccac2b26bde6b9cec891613a06558b70017dd3a9 100644 (file)
@@ -1,3 +1,8 @@
+2004-09-09  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * lyx_cb.C (Reconfigure): quote the name of configure script in
+       case it contains spaces
+
 2004-09-04  Lars Gullik Bjonnes  <larsbj@gullik.net>
 
        * client: new dir
index e4c95ccf726ff665775135670404eded323d17bb..ec99cafd3054f75da39da63d7fe6066149e1ff5f 100644 (file)
@@ -1,3 +1,8 @@
+2004-09-09  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * qfont_loader.C (addFontPath): quote the name of the font dir in
+       case it contains a space
+
 2004-08-19  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
 
        * BulletsModule.C (setBullet): use toqstr() for a string passed to
index 1c7e9ced3a6bec23db4f9bc1f8a5b0cf09c186b7..6f1cb146a4991f91f0113bed3a6435214ea13e6a 100644 (file)
@@ -36,6 +36,7 @@
 using lyx::support::contains;
 using lyx::support::LibFileSearch;
 using lyx::support::OnlyPath;
+using lyx::support::QuoteName;
 using lyx::support::Systemcall;
 
 using std::endl;
@@ -63,7 +64,7 @@ void addFontPath()
                        return;
                lyxerr[Debug::FONT] << "Adding " << dir
                                    << " to the font path." << endl;
-               string const command = "xset fp+ " + dir;
+               string const command = "xset fp+ " + QuoteName(dir);
                Systemcall s;
                if (!s.startscript(Systemcall::Wait, command))
                        return;
index 663c4c46818e9242290677a63b6f2a24ad1b6b85..6988a430e707ba0d934820dcf5b6c7f586ca5c31 100644 (file)
@@ -62,6 +62,7 @@ using lyx::support::MakeDisplayPath;
 using lyx::support::OnlyFilename;
 using lyx::support::OnlyPath;
 using lyx::support::Path;
+using lyx::support::QuoteName;
 using lyx::support::removeAutosaveFile;
 using lyx::support::rename;
 using lyx::support::split;
@@ -446,7 +447,7 @@ void Reconfigure(BufferView * bv)
        Path p(user_lyxdir());
        Systemcall one;
        one.startscript(Systemcall::Wait,
-                       AddName(system_lyxdir(), "configure"));
+                       QuoteName(AddName(system_lyxdir(), "configure")));
        p.pop();
        bv->owner()->message(_("Reloading configuration..."));
        lyxrc.read(LibFileSearch(string(), "lyxrc.defaults"));
index f1636c967bf0e82da562f39cab635e6a7e845639..9f180be253f868c051447bcd4084b473694e78cd 100644 (file)
@@ -1,3 +1,8 @@
+2004-09-10  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * filetools.C (LibScriptSearch): quote the path of the script, in
+       case it contains spaces
+
 2004-09-04  Lars Gullik Bjonnes  <larsbj@gullik.net>
 
        * tostr.C: reimplement using lexical_cast
index c9ea4562a86aeb1bcc048b51951ac1410e1e90aa..d8426901852d8b58a9d2db63f4b1943ddcff337e 100644 (file)
@@ -372,7 +372,7 @@ string const LibScriptSearch(string const & command_in)
        } else {
                // Replace "$$s/some_script" with "$LYX_SCRIPT_PATH/some_script"
                string::size_type const size_replace = size_script + 4;
-               command.replace(pos1, size_replace, script);
+               command.replace(pos1, size_replace, QuoteName(script));
        }
 
        return command;