Perform the executable validation along with the version check in _create_repl()
#241
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is my solution to an octave-path issue I just run into running
oct2py
.In Windows, my default Octave installation path has spaces, and it is not boding well with how the subprocess is spawned when used with the
OCTAVE_EXECUTABLE
environment. I tried to circumvent this issue by using the DOS path which can be generated easily with a Windows batch file (an example here) but it produces an all-caps space-free path, which fails the executable finding mechanism.There are two approaches to alleviate this issue: (a) to allow spaces in the path and (b) to allow octave path to be not containing case-sensitive
'octave'
string. (There is another of manually fixing the capitalization but that shouldn't be needed.) Based on my code review, it appears that the former must be addressed by themetakernel
package while the latter can be addressed by this package. And a proposed solution is this PR.The Octave name check is currently done in
OctaveEngine._get_executable()
and there is a version checking inOctaveEngine._create_repl()
if the name checking fails (or if'snap'
is used, which I'm not familiar with). It seems sensible to remove the octave name check in the path and perform the executable check along with the version check because the executable file can be renamed to whatever by user or an alternate path like in my case with the DOS path.I tested the PR with a simple test:
P.S., I actually think allowing the spaces in the path is the correct fix, and
I'll see ifif a solution for it is desirable, I will create a PR onmetakernel
maintainer agrees for my proposed change, I'll get back here later for another PR if acceptable.metakernel
repo later to enable the fix. (edit: I didn't realize both are under the same org)