Remove entry point manipulation and runfiles
Trimming the entry point has been moved to build time, and we had
already removed the runfiles directory from the build side.
Test: m
Change-Id: I12137c78007a57cd0d24d210c26c7cfdcda820b5
diff --git a/Launcher/launcher_internal.cpp b/Launcher/launcher_internal.cpp
index 01274bb..7d5b25a 100644
--- a/Launcher/launcher_internal.cpp
+++ b/Launcher/launcher_internal.cpp
@@ -105,20 +105,6 @@
Py_DECREF(py_data);
Py_DECREF(files);
- int i = 0;
- /* Strip newline and other trailing whitespace. */
- for (i = strlen(res) - 1; i >= 0 && isspace(res[i]); i--) {
- res[i] = '\0';
- }
- /* Check for the file extension. */
- i = strlen(res);
- if (i > 3 && strcmp(res + i - 3, ".py") == 0) {
- res[i - 3] = '\0';
- } else {
- PyErr_Format(PyExc_ValueError, "Invalid entrypoint in %s: %s",
- ENTRYPOINT_FILE, res);
- return std::string();
- }
return std::string(res);
}
@@ -128,26 +114,11 @@
}
// Has to pass to free to avoid a memory leak after use.
char *arr = strdup(entrypoint.c_str());
- // Replace file system path seperator with Python package/module seperator.
- char *ch;
- for (ch = arr; *ch; ch++) {
- if (*ch == '/') {
- *ch = '.';
- }
- }
if (AddPathToPythonSysPath(launcher_path) < 0) {
free(arr);
return -1;
}
- // Calculate the runfiles path size. Extra space for '\0'.
- size_t size = snprintf(nullptr, 0, "%s/%s", launcher_path, RUNFILES) + 1;
- char runfiles_path[size];
- snprintf(runfiles_path, size, "%s/%s", launcher_path, RUNFILES);
- if (AddPathToPythonSysPath(runfiles_path) < 0) {
- free(arr);
- return -1;
- }
int ret = RunModule(arr, 0);
free(arr);
return ret;
diff --git a/Launcher/launcher_internal.h b/Launcher/launcher_internal.h
index 285176a..aa5f2dd 100644
--- a/Launcher/launcher_internal.h
+++ b/Launcher/launcher_internal.h
@@ -25,7 +25,6 @@
namespace internal{
#define ENTRYPOINT_FILE "entry_point.txt"
-#define RUNFILES "runfiles"
// Use "runpy" module to locate and run Python script using Python module
// namespace rather than the filesystem.