Sublime Forum

Build system variables not working at all

#1

I have defined a project file that looks like this:

[code]{
“folders”:

    {
        "path": "./"
    }
],
"build_systems": 
    {
        "name": "Custom build system",
        "path": "./virtualenv/Scripts",
        "cmd": "where", "python"],
        "env": {
            "PYTHONPATH": "./"
        }
    }
]

}[/code]

This works perfectly as long as I’m on a file in the top level directory. As soon as I descend into a child directory, the “./” paths break and I get “not found” errors. Therefore I’m trying to use the “$project_path” variable that’s shown here: http://docs.sublimetext.info/en/latest/reference/build_systems.html#build-system-variables. The problem is: it doesn’t work at all. I get the same “not found” errors as before.

I have tried:

"path": "$project_path/virtualenv/Scripts"
"path": "${project_path}/virtualenv/Scripts"
"path": "${project_path}\\virtualenv\\Scripts"

and nothing works. Python.exe is still not found. I have also tried to leave “path” at the relative path and set PYTHONPATH to “$project_path”, then set “cmd” to

"python", "-c", "import sys;print sys.path"]

The output contains:

So it’s clear that in this case, “$project_path” isn’t even being replaced. It probably isn’t in the rest of the build system either. Why not? What am I doing wrong?

0 Likes

#2

A litlle late, but here is a solution that I used - I`ve set as build_systems inside sublime project configs.
The example.sublime-project looks like:

[code]{
“folders”:

{
“path”: “/path/to/your/project”
}
],
“build_systems”:

    {
        "name": "Run Tests",
        // activate the specific virtualenv for the project
        "cmd": "source", "/path/to/your/virtualenv/bin/activate"],
        // now indicates a different folder to run the next cmd
        "working_dir": "/path/to/to/you/django_project",
        // runs the test
        "cmd": "python", "manage.py", "test"]
    }
]

}[/code]

:wink:
cheers

0 Likes