Hi,
I’m trying to get sublime_text internal console/build to work in a somewhat complex need/env system where the context & allowed versions can change a lot. I need the build system to be easily switchable, ideally dynamically.
This
/Packages/Python/Python.sublime-build
seems to be the key.
This is default
{
“cmd”: “python”, “-u”, “$file”],
“file_regex”: “^ ]File "(…?)”, line ([0-9])",
“selector”: “source.python”,
}*
So there could be 2 ways.
One could be declaring pythonpaths. i.e.
- “env”: {“PYTHONPATH”: “/bla1/lib”}*
Unfortunately in my case, these consist of dozens to 100s of libs in various version, depending on context. So altering those depending on where it needs to be run is impractical.
So the next idea was to use multiple cmd issues that build upon each other. But looks like multiple cmd statements are not supported in the same line:
i.e.
- “cmd”: “setMyEnv”, “/giveMe/env1”,"&",“python”, “-u”, “$file”],*
fails with:
[Errno 2] No such file or directory
and if I do it in consecutive commands (setMyEnv in a linux shell would set the libraries/module version as I need them), which runs through a build fine, i.e.
- “cmd”: “setMyEnv”, “/giveMe/env1”],
“cmd”: “python”, “-u”, “$file”],*
but the 2nd cmd does not know about the first, and I am still env-less.
This seems to be something that regularly pops up for others. See
viewtopic.php?f=3&t=6386&p=27708&hilit=build+cmd+multiple#p27708 )
sublimetext.userecho.com/topic/8 … ld-system/
Multiple cmd in build system? (offers a shell=true solution, but that does not seem to work for me)
Has anyone got any tips how this could be tackled ? Or is that something that’s being looked into in sublime dev ?
Cheers.
c.
ps
there’s also this,
blog.pcitron.fr/2013/02/08/multi … ld-system/
again with shell+true, for Windows.
So for Linux this should be:
- “cmd”: “setDynamicPythonEnv”, “env1”, “;” “python”, “-u”, “$file”], *
But no matter which syntax I try for “;”, I end up with this when the linux syntax seems to be working:
[Errno 2] No such file or directory
And a sublime build error message when the syntax is bad:
“Error trying to parse build system: Unexpected character, expected a comma or closing bracket in ~/.config/sublime-text-2/Packages/Python/Python.sublime-build:4:45”