From: Benjamin Piwowarski <[email protected]>
> Date: Fri, 14 Mar 2014 10:48:40 +0000 (+0100)
> Subject: Fix problem with python and change of PATH
> X-Git-Url:
> http://git.lyx.org/?p=lyx.git;a=commitdiff_plain;h=49b943e8458c6d23a7db29033e92601c7404fff5
>
> Fix problem with python and change of PATH
>
> - waits that lyxrc has been read before finding python
> - when the PATH changes, resets the value
> ---
>
> << "\tbinary_dir " << binary_dir().absFileName() << '\n'
> @@ -156,6 +151,19 @@ Package::Package(string const & command_line_arg0,
> << "</package>\n");
> }
>
> +std::string const & Package::configure_command() const
> +{
> + if (configure_command_.empty()) {
> + std::string &command =
> const_cast<std::string&>(configure_command_);
> + FileName const
> configure_script(addName(system_support().absFileName(), "configure.py"));
> + command = os::python() + ' ' +
> + quoteName(configure_script.toFilesystemEncoding()) +
> + with_version_suffix() + " --binary-dir=" +
> +
> quoteName(FileName(binary_dir().absFileName()).toFilesystemEncoding());
> + }
> + return configure_command_;
> +}
> +
Either deconsitfy this function, or make configure_command_ a mutable
member. In any case, do not use const_cast<>. Moreover, try not to use
non-const references if not explicitly needed. Especially not if it
points to a variable that is used in the same function under a
different name.
>
>
> -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
I don't know whether I completely like this. Maybe we should have
Package store the value of the python interpreter, and make an
explicit function: findPython to update the member.
Vincent