[CalendarServer-changes] [15387] CalendarServer/trunk/support

source_changes at macosforge.org source_changes at macosforge.org
Mon Dec 14 12:05:17 PST 2015


Revision: 15387
          http://trac.calendarserver.org//changeset/15387
Author:   sagen at apple.com
Date:     2015-12-14 12:05:17 -0800 (Mon, 14 Dec 2015)
Log Message:
-----------
Remove embedded interpreter and no longer apply app group plist to python-wrapper

Modified Paths:
--------------
    CalendarServer/trunk/support/Apple.make
    CalendarServer/trunk/support/python-wrapper.c

Modified: CalendarServer/trunk/support/Apple.make
===================================================================
--- CalendarServer/trunk/support/Apple.make	2015-12-14 17:44:36 UTC (rev 15386)
+++ CalendarServer/trunk/support/Apple.make	2015-12-14 20:05:17 UTC (rev 15387)
@@ -64,7 +64,7 @@
 build-wrapper: $(BuildDirectory)/python-wrapper
 
 $(BuildDirectory)/python-wrapper: $(Sources)/support/python-wrapper.c
-	$(CC) -I /usr/include/python2.7 -l python2.7 -sectcreate __TEXT __info_plist $(Sources)/support/appgroup.plist $(Sources)/support/python-wrapper.c -o $(BuildDirectory)/python-wrapper
+	$(CC) $(Sources)/support/python-wrapper.c -o $(BuildDirectory)/python-wrapper
 
 install:: install-python
 install-python:: build

Modified: CalendarServer/trunk/support/python-wrapper.c
===================================================================
--- CalendarServer/trunk/support/python-wrapper.c	2015-12-14 17:44:36 UTC (rev 15386)
+++ CalendarServer/trunk/support/python-wrapper.c	2015-12-14 20:05:17 UTC (rev 15387)
@@ -9,7 +9,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <pwd.h>
-#include <Python.h>
 
 const char * const allowedUsernames[] = {
     "_calendar",
@@ -73,29 +72,6 @@
     return 0;
 }
 
-char *getCodeToExecute() {
-    char *buffer = NULL;
-    const char* filename = getenv("CS_EXECUTE_EMBEDDED");
-    if (filename != NULL) {
-        FILE *file;
-        if ((file = fopen(filename, "r"))) {
-            struct stat statbuf;
-            if (fstat(fileno(file), &statbuf) == 0) {
-                int size = statbuf.st_size;
-                buffer = malloc((size+1) * sizeof(char));
-                int num = fread(buffer, 1, size, file);
-                if (num != size) {
-                    free(buffer);
-                    buffer = NULL;
-                } else {
-                    buffer[size] = 0;
-                }
-            }
-            fclose(file);
-        }
-    }
-    return buffer;
-}
 
 int main(int argc, const char * argv[]) {
 
@@ -104,19 +80,9 @@
         prependToPath("PATH", bin);
         prependToPath("PYTHONPATH", site);
 
-        char *code = getCodeToExecute();
-        if (code != NULL) {
-            printf("Executing code:\n%s\n", code);
-            Py_SetProgramName((char *)argv[0]);
-            Py_Initialize();
-            PyRun_SimpleString(code);
-            Py_Finalize();
-            return 0;
-        } else {
-            // Launch real python
-            argv[0] = python;
-            return execvp(python, (char* const*)argv);
-        }
+        // Launch real python
+        argv[0] = python;
+        return execvp(python, (char* const*)argv);
     } else {
         printf("You are not allowed to run this executable.\n");
         return 1;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20151214/97af8a95/attachment.html>


More information about the calendarserver-changes mailing list