diff options
author | nkozlovskiy <nmk@ydb.tech> | 2023-09-29 12:24:06 +0300 |
---|---|---|
committer | nkozlovskiy <nmk@ydb.tech> | 2023-09-29 12:41:34 +0300 |
commit | e0e3e1717e3d33762ce61950504f9637a6e669ed (patch) | |
tree | bca3ff6939b10ed60c3d5c12439963a1146b9711 /contrib/tools/python/bootstrap/python.c | |
parent | 38f2c5852db84c7b4d83adfcb009eb61541d1ccd (diff) | |
download | ydb-e0e3e1717e3d33762ce61950504f9637a6e669ed.tar.gz |
add ydb deps
Diffstat (limited to 'contrib/tools/python/bootstrap/python.c')
-rw-r--r-- | contrib/tools/python/bootstrap/python.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/contrib/tools/python/bootstrap/python.c b/contrib/tools/python/bootstrap/python.c new file mode 100644 index 0000000000..5090f65277 --- /dev/null +++ b/contrib/tools/python/bootstrap/python.c @@ -0,0 +1,50 @@ +#include <stdlib.h> +#include <stdio.h> + +#include "vars.h" + +#include <util/system/platform.h> + +#define main RealMain +#include "Modules/python.c" +#undef main + +int main(int argc, char** argv) { + char* distArcPath = getenv("ARCADIA_ROOT_DISTBUILD"); + char* pyPath = NULL; + char* mx = 0; + char* x = 0; + int ret; + putenv("PYTHONHOME="); + putenv("PY_IGNORE_ENVIRONMENT="); + putenv("PYTHONDONTWRITEBYTECODE=x"); + if (distArcPath) { + pyPath = malloc(strlen("PYTHONPATH=") + strlen(distArcPath) + strlen(GetPyLib()) + 2); + + if (!pyPath) + abort(); + + mx = strdup(GetPyLib()); + x = mx; + + if (!x) + abort(); + + if (*x && *x == '"') { + x += 1; + x[strlen(x) - 1] = 0; + } + + sprintf(pyPath, "PYTHONPATH=%s/%s", distArcPath, x); + } else { + pyPath = malloc(strlen("PYTHONPATH=") + strlen(GetLibDir()) + 1); + sprintf(pyPath, "PYTHONPATH=%s", GetLibDir()); + } + putenv(pyPath); + ret = RealMain(argc, argv); + if (pyPath) + free(pyPath); + if (mx) + free(mx); + return ret; +} |