Fix problem with python and change of PATH

- waits that lyxrc has been read before finding python
- when the PATH changes, resets the value
- updated status.21x
This commit is contained in:
Benjamin Piwowarski 2014-03-14 11:48:40 +01:00 committed by Richard Heck
parent 0fd4db5c9a
commit a0cc99ff6a
6 changed files with 30 additions and 10 deletions

View 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:

View 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
{

View 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_;
};

View 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

View 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();

View 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