>>>>> "Joost" == Joost Verburg <[EMAIL PROTECTED]> writes:
Joost> Python is available and has been added to path_prefix in
Joost> lyxrc.dist. What is the difference between path_prefix and
Joost> extra_path?
I meant path_prefix. The problem was that reconfiguration was done
before readong lyxrc.dist.
Try the following (I did not test it).
JMarc
Index: src/lyx_main.C
===================================================================
--- src/lyx_main.C (revision 13791)
+++ src/lyx_main.C (working copy)
@@ -401,16 +401,6 @@ void LyX::init(bool gui)
signal(SIGTERM, error_handler);
// SIGPIPE can be safely ignored.
- // Check that user LyX directory is ok. We don't do that if
- // running in batch mode.
- bool reconfigure = false;
- if (gui) {
- reconfigure =
- queryUserLyXDir(package().explicit_user_support());
- } else {
- first_start = false;
- }
-
// Disable gui when easyparse says so
lyx_gui::use_gui = gui;
@@ -439,6 +429,23 @@ void LyX::init(bool gui)
// This one may have been distributed along with LyX.
readRcFile("lyxrc.dist");
+
+#if !defined (USE_POSIX_PACKAGING)
+ // Add the directory containing the LyX executable to the path
+ // so that LyX can find things like tex2lyx.
+ if (package().build_support().empty())
+ prependEnvPath("PATH", package().binary_dir());
+#endif
+
+ // Check that user LyX directory is ok. We don't do that if
+ // running in batch mode.
+ if (gui) {
+ if (queryUserLyXDir(package().explicit_user_support()))
+ reconfigureUserLyXDir();
+ } else {
+ first_start = false;
+ }
+
// This one is generated in user_support directory by lib/configure.py.
readRcFile("lyxrc.defaults");
@@ -475,18 +482,6 @@ void LyX::init(bool gui)
if (!lyxrc.path_prefix.empty())
prependEnvPath("PATH", lyxrc.path_prefix);
-#if !defined (USE_POSIX_PACKAGING)
- // Add the directory containing the LyX executable to the path
- // so that LyX can find things like tex2lyx.
- if (package().build_support().empty())
- prependEnvPath("PATH", package().binary_dir());
-#endif
-
- // Having reset the PATH we're now in a position to run configure
- // if necessary.
- if (reconfigure)
- reconfigureUserLyXDir();
-
if (fs::exists(lyxrc.document_path) &&
fs::is_directory(lyxrc.document_path))
package().document_dir() = lyxrc.document_path;
@@ -609,25 +604,43 @@ void LyX::deadKeyBindings(kb_keymap * kb
}
-bool LyX::queryUserLyXDir(bool explicit_userdir)
+namespace {
+
+// return true if file does not exist or is older than configure.py.
+bool needsUpdate(string const & file)
{
- bool reconfigure = false;
+ static string const configure_script =
+ AddName(package().system_support(), "configure.py");
+ string const absfile =
+ AddName(package().user_support(), file);
+
+ lyxerr << "absfile=" << absfile << ", exists=" << fs::exists(absfile);
+ if (fs::exists(absfile))
+ lyxerr << ", write(conf)=" << fs::last_write_time(configure_script)
+ << ", write(file)=" << fs::last_write_time(absfile)
+ << ", result=" << ((! fs::exists(absfile))
+ || (fs::last_write_time(configure_script)
+ > fs::last_write_time(absfile)));
+ lyxerr << endl;
+
+ return (! fs::exists(absfile))
+ || (fs::last_write_time(configure_script)
+ > fs::last_write_time(absfile));
+}
+
+}
+
+bool LyX::queryUserLyXDir(bool explicit_userdir)
+{
// Does user directory exist?
if (fs::exists(package().user_support()) &&
fs::is_directory(package().user_support())) {
first_start = false;
- string const configure_script =
- AddName(package().system_support(), "configure.py");
- string const userDefaults =
- AddName(package().user_support(), "lyxrc.defaults");
- if (fs::exists(configure_script) &&
- fs::exists(userDefaults) &&
- fs::last_write_time(configure_script)
- > fs::last_write_time(userDefaults)) {
- reconfigure = true;
- }
- return reconfigure;
+
+ return needsUpdate("lyxrc.defaults")
+ || needsUpdate("textclass.lst")
+ || needsUpdate("packages.lst");
}
first_start = !explicit_userdir;
@@ -651,7 +664,6 @@ bool LyX::queryUserLyXDir(bool explicit_
lyxerr << bformat(_("LyX: Creating directory %1$s"),
package().user_support())
<< endl;
- reconfigure = true;
if (!createDirectory(package().user_support(), 0755)) {
// Failed, so let's exit.
@@ -660,7 +672,7 @@ bool LyX::queryUserLyXDir(bool explicit_
exit(1);
}
- return reconfigure;
+ return true;
}