blob: 5090f652776b347d40288b44e925ccc5e614f631 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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;
}
|