Home Download Buy Blog Forum Support

variables for custom build cmd - [solved]

variables for custom build cmd - [solved]

Postby urms on Sun Jul 15, 2012 12:49 pm

Hi, just started using ST2 and would like to use it with Python VirtualEnv.

I created a new .sublime-build file with following content.

Code: Select all
{
   "cmd": ["/Path/to/VirtualEnv/bin/python", "/Another/Path/to/myscript.py"]
}


this works just fine ... but this feels a bit restricted, as my .py-file is hardcoded into the custom build system.

I would like to use something like this (Pseudo-)Code:

Code: Select all
{
   "cmd": ["/Path/to/VirtualEnv/bin/python", $CurrentFile]
}


Where "$CurrentFile" would point to the file, which tab is in the foreground and Cmd+B (OS X) therefore is triggered for that file's building or here more executing purpose.

I tried without the
Code: Select all
, "/Another/Path/to/myscript.py"
part, which seemingly did not execute the file's tab currently in foreground and focus, it only opened the Python environment in the Console of ST2.

I assume something like 'self' or 'this' might be the key, but I do not find the syntax Sublime Text 2 expects. here.

Thanks in advance for any help or hint,

Cheers,
Ulf
Last edited by urms on Sun Jul 15, 2012 12:58 pm, edited 1 time in total.
urms
 
Posts: 3
Joined: Sun Jul 15, 2012 12:38 pm

Re: variables for custom build cmd

Postby iamntz on Sun Jul 15, 2012 12:52 pm

Have a look here. I think this is what are you looking for.
iamntz
 
Posts: 915
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania

Re: variables for custom build cmd

Postby urms on Sun Jul 15, 2012 12:57 pm

Thanks a lot - I just found myself and wanted to close this ;) ... when I checked the 'unofficial' one.

So for anyone else, here is the code for a PythonVirtualEnv.sublime-build file:

Code: Select all
{
   "cmd": ["/Path/to/VirtualEnv/bin/python", "$file"]
}



Happy coding!

Cheers,
Ulf
urms
 
Posts: 3
Joined: Sun Jul 15, 2012 12:38 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Yahoo [Bot] and 29 guests