blob: a146c747f83df9ea9a5ff23388552a16d68e4710 [file] [log] [blame]
Brad Bishopf3f93bb2019-10-16 14:33:32 -04001From 5ce3ac59531828ff682646fbba59b2126b28a8aa Mon Sep 17 00:00:00 2001
Brad Bishopc342db32019-05-15 21:57:59 -04002From: Jaewon Lee <jaewon.lee@xilinx.com>
3Date: Thu, 25 Apr 2019 15:34:26 -0700
4Subject: [PATCH] main.c: if OEPYTHON3HOME is set use instead of PYTHONHOME
5
6There is one variable PYTHONHOME to determine where libraries are coming
7from for both python2 and python3. This becomes an issue if only one has
8libraries in the specified PYTHONHOME path, but they are using the same
9PYTHONHOME. Creating another variable OEPYTHON3HOME to allow for a way
10to set a different path for python3
11
12Signed-off-by: Jaewon Lee <jaewon.lee@xilinx.com>
13
14Upstream-Status: Inappropriate [OE specific configuration]
Brad Bishopf3f93bb2019-10-16 14:33:32 -040015
Brad Bishopc342db32019-05-15 21:57:59 -040016---
17 Modules/main.c | 17 +++++++++++++----
18 1 file changed, 13 insertions(+), 4 deletions(-)
19
20diff --git a/Modules/main.c b/Modules/main.c
Brad Bishopf3f93bb2019-10-16 14:33:32 -040021index acc59c6..407085a 100644
Brad Bishopc342db32019-05-15 21:57:59 -040022--- a/Modules/main.c
23+++ b/Modules/main.c
Brad Bishopf3f93bb2019-10-16 14:33:32 -040024@@ -1834,10 +1834,19 @@ config_init_home(_PyCoreConfig *config)
Brad Bishopc342db32019-05-15 21:57:59 -040025 }
26 return _Py_INIT_OK();
27 }
28-
29- int res = config_get_env_var_dup(&home, L"PYTHONHOME", "PYTHONHOME");
30- if (res < 0) {
31- return DECODE_LOCALE_ERR("PYTHONHOME", res);
32+ int res;
33+ const char *oepython3home = config_get_env_var("OEPYTHON3HOME");
34+ if (oepython3home) {
35+ res = config_get_env_var_dup(&home, L"OEPYTHON3HOME", "OEPYTHON3HOME");
36+ if (res < 0) {
37+ return DECODE_LOCALE_ERR("OEPYTHON3HOME", res);
38+ }
39+ }
40+ else {
41+ res = config_get_env_var_dup(&home, L"PYTHONHOME", "PYTHONHOME");
42+ if (res < 0) {
43+ return DECODE_LOCALE_ERR("PYTHONHOME", res);
44+ }
45 }
46 config->home = home;
47 return _Py_INIT_OK();