]> git.lyx.org Git - features.git/commitdiff
Fix problem with python and change of PATH
authorBenjamin Piwowarski <bpiwowar@lyx.org>
Fri, 14 Mar 2014 10:48:40 +0000 (11:48 +0100)
committerRichard Heck <rgheck@lyx.org>
Fri, 18 Apr 2014 14:52:47 +0000 (10:52 -0400)
- waits that lyxrc has been read before finding python
- when the PATH changes, resets the value
- updated status.21x

src/LyXRC.cpp
src/support/Package.cpp
src/support/Package.h
src/support/os.cpp
src/support/os.h
status.21x

index f3183164bcaffd158c655f148f6adda75ab2dbba..80b85141d25145e2a3eab443aae6030d480e19b1 100644 (file)
@@ -3006,6 +3006,8 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_PATH_PREFIX:
                if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
                        prependEnvPath("PATH", lyxrc_new.path_prefix);
+                       // Resets python path
+                       support::os::python(true);
                }
        case LyXRC::RC_PREVIEW:
        case LyXRC::RC_PREVIEW_HASHED_LABELS:
index 96b8dae415a462b6a043b1dc7ac79d7338b50ff1..b4b0e1493df7d9f16965eb7c6567979d06f1602a 100644 (file)
@@ -138,11 +138,6 @@ Package::Package(string const & command_line_arg0,
        explicit_user_support_dir_ = userSupportDir(default_user_support_dir,
                                     command_line_user_support_dir, user_support_dir_);
 
-       FileName const configure_script(addName(system_support().absFileName(), "configure.py"));
-       configure_command_ = os::python() + ' ' +
-                       quoteName(configure_script.toFilesystemEncoding()) +
-                       with_version_suffix() + " --binary-dir=" +
-                       quoteName(FileName(binary_dir().absFileName()).toFilesystemEncoding());
 
        LYXERR(Debug::INIT, "<package>\n"
                << "\tbinary_dir " << binary_dir().absFileName() << '\n'
@@ -156,6 +151,18 @@ Package::Package(string const & command_line_arg0,
                << "</package>\n");
 }
 
+std::string const & Package::configure_command() const
+{
+       if (configure_command_.empty()) {
+               FileName const configure_script(addName(system_support().absFileName(), "configure.py"));
+               configure_command_ = os::python() + ' ' +
+                       quoteName(configure_script.toFilesystemEncoding()) +
+                       with_version_suffix() + " --binary-dir=" +
+                       quoteName(FileName(binary_dir().absFileName()).toFilesystemEncoding());
+       }
+       return configure_command_;
+}
+
 
 void Package::set_temp_dir(FileName const & temp_dir) const
 {
index 064f662e4e37577d2a1da284818bb3a2c67d3e86..e5cc32326044e6025ee96d9428c7d860e597cf6c 100644 (file)
@@ -138,7 +138,7 @@ public:
         *  Caution: This is "ready-to-run", i.e. in the locale encoding, not
         *  utf8.
         */
-       std::string const & configure_command() const { return configure_command_; }
+       std::string const & configure_command() const;
 
 private:
        FileName binary_dir_;
@@ -151,7 +151,7 @@ private:
        mutable FileName document_dir_;
        mutable FileName temp_dir_;
        FileName system_temp_dir_;
-       std::string configure_command_;
+       mutable std::string configure_command_;
        bool explicit_user_support_dir_;
        bool in_build_dir_;
 };
index aa2da7f1746be1bda515b2cb7cb59e6d4ebc3c8a..8f60c68fb4c5339e60cc8c4e4a56898c6416006b 100644 (file)
@@ -60,10 +60,13 @@ int timeout_min()
 }
 
 
-string const python()
+string const python(bool reset)
 {
        // Check whether the first python in PATH is the right one.
        static string command = python2("python -tt");
+       if (reset) {
+               command = python2("python -tt");
+       }
 
        if (command.empty()) {
                // It was not, so check whether we can find it elsewhere in
index d66173b1a73e6e50d35a019e577e2b346ae7ca52..73eb86d7f331c51853fb5e972d5cb9cea038d6f5 100644 (file)
@@ -59,7 +59,8 @@ shell_type shell();
 int timeout_min();
 
 /// Name of the python interpreter
-std::string const python();
+/// @param reset True if the python path should be recomputed
+std::string const python(bool reset = false);
 
 ///
 bool isFilesystemCaseSensitive();
index c201f89d6bf9c3dc0b9bdbaacc08c2d82158deb6..cb44e134c8ec96d8efeb70e8ace609c7ed4e8126 100644 (file)
@@ -71,7 +71,14 @@ What's new
 - Fix "Select Section" function in the Outliner (bug 8936).
 
 - Fix select-by-doubleclick in mathed (bug 8829).
-  
+
+
+
+* INTERNALS
+
+- Fix a problem when PATH changes and python command is relative (bug 8950).
+
 
 * DOCUMENTATION AND LOCALIZATION