mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
get python3 scripts running with venv
This commit is contained in:
parent
4e7f512d3b
commit
60e932f2f7
1 changed files with 10 additions and 2 deletions
|
@ -469,8 +469,16 @@ static int CmdScriptRun(const char *Cmd) {
|
||||||
|
|
||||||
// We disallowed in py_conf environment variables interfering with python interpreter's behavior.
|
// We disallowed in py_conf environment variables interfering with python interpreter's behavior.
|
||||||
// Let's manually enable the ones we truly need.
|
// Let's manually enable the ones we truly need.
|
||||||
// This is required by Proxspace to work with an isolated Python configuration
|
const char *virtual_env = getenv("VIRTUAL_ENV");
|
||||||
PyConfig_SetBytesString(&py_conf, &py_conf.home, getenv("PYTHONHOME"));
|
if (virtual_env != NULL) {
|
||||||
|
size_t length = strlen(virtual_env) + strlen("/bin/python3") + 1;
|
||||||
|
char python_executable_path[length];
|
||||||
|
snprintf(python_executable_path, length, "%s/bin/python3", virtual_env);
|
||||||
|
PyConfig_SetBytesString(&py_conf, &py_conf.executable, python_executable_path);
|
||||||
|
} else {
|
||||||
|
// This is required by Proxspace to work with an isolated Python configuration
|
||||||
|
PyConfig_SetBytesString(&py_conf, &py_conf.home, getenv("PYTHONHOME"));
|
||||||
|
}
|
||||||
// This is required for allowing `import pm3` in python scripts
|
// This is required for allowing `import pm3` in python scripts
|
||||||
PyConfig_SetBytesString(&py_conf, &py_conf.pythonpath_env, getenv("PYTHONPATH"));
|
PyConfig_SetBytesString(&py_conf, &py_conf.pythonpath_env, getenv("PYTHONPATH"));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue