Restore getpath.c closer to upstream
Instead of changing the control flow significantly, use SetPythonHome,
-DPYTHONPATH, and a handful of ifdefs.
Test: build/soong/python/tests/runtest.sh
Test: git diff 18e21883a4..HEAD -- Modules/getpath.c
Change-Id: I27ca46f953c160e437b1610085cc756056ba3812
diff --git a/Launcher/launcher_main.cpp b/Launcher/launcher_main.cpp
index 09a9d39..c0b0c49 100644
--- a/Launcher/launcher_main.cpp
+++ b/Launcher/launcher_main.cpp
@@ -42,6 +42,9 @@
// android::base::GetExecutablePath() also handles for Darwin/Windows.
std::string executable_path = android::base::GetExecutablePath();
+ // Set the equivalent of PYTHONHOME internally.
+ Py_SetPythonHome(strdup(executable_path.c_str()));
+
int new_argc = argc + 1;
char **new_argv = reinterpret_cast<char**>(calloc(new_argc, sizeof(*argv)));