diff options
author | 2014-04-19 12:02:29 +0200 | |
---|---|---|
committer | 2014-04-19 12:02:29 +0200 | |
commit | 19a5ade24cfcd351f7e555e114b8b63140244ee4 (patch) | |
tree | 4aa57023a0a0466704f2c88518e2465344318fc0 | |
parent | Updates for 3.4.0 (diff) | |
download | python-gentoo-patches-3.4.0.tar.gz python-gentoo-patches-3.4.0.tar.bz2 python-gentoo-patches-3.4.0.zip |
Remove python.eclass-specific 61_all_process_data.patch.3.4.0
We do not support Python 3.4 with python.eclass anymore, so the scripts
relying on the extra variables will not be run with Python 3.4.
Therefore, we can finally remove the Gentoo-specific hacks.
Fixes: https://bugs.gentoo.org/show_bug.cgi?id=507890
-rw-r--r-- | patches/61_all_process_data.patch | 173 |
1 files changed, 0 insertions, 173 deletions
diff --git a/patches/61_all_process_data.patch b/patches/61_all_process_data.patch deleted file mode 100644 index 7b7e126..0000000 --- a/patches/61_all_process_data.patch +++ /dev/null @@ -1,173 +0,0 @@ -GENTOO_PYTHON_PROCESS_NAME environmental variable is set by python-wrapper and wrapper scripts generated by -python_generate_wrapper_scripts() and specifies process name. -GENTOO_PYTHON_WRAPPER_SCRIPT_PATH environmental variable is set by wrapper scripts generated by -python_generate_wrapper_scripts() and specifies sys.argv[0] in target executables. -GENTOO_PYTHON_TARGET_SCRIPT_PATH environmental variable is set by wrapper scripts generated by -python_generate_wrapper_scripts() and specifies paths to actually executed scripts. -GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION environmental variable is used by wrapper scripts generated by -python_generate_wrapper_scripts() to check if Python supports GENTOO_PYTHON_TARGET_SCRIPT_PATH environmental variable. - ---- Modules/main.c -+++ Modules/main.c -@@ -343,6 +343,7 @@ - int version = 0; - int saw_unbuffered_flag = 0; - PyCompilerFlags cf; -+ char *target_script_name = getenv("GENTOO_PYTHON_TARGET_SCRIPT_PATH"); - - cf.cf_flags = 0; - -@@ -563,7 +564,17 @@ - if (command == NULL && module == NULL && _PyOS_optind < argc && - wcscmp(argv[_PyOS_optind], L"-") != 0) - { -- filename = argv[_PyOS_optind]; -+ if (target_script_name != NULL && *target_script_name != '\0') { -+ size_t length = strlen(target_script_name); -+ wchar_t *wcs_target_script_name = (wchar_t *) calloc(length + 1, sizeof(wchar_t)); -+ char *old_locale = setlocale(LC_CTYPE, NULL); -+ setlocale(LC_CTYPE, ""); -+ if (mbstowcs(wcs_target_script_name, target_script_name, length) >= 0) -+ filename = wcs_target_script_name; -+ setlocale(LC_CTYPE, old_locale); -+ } -+ if (filename == NULL) -+ filename = argv[_PyOS_optind]; - } - - stdin_is_interactive = Py_FdIsInteractive(stdin, (char *)0); ---- Modules/posixmodule.c -+++ Modules/posixmodule.c -@@ -1239,6 +1239,10 @@ - char *p = strchr(*e, '='); - if (p == NULL) - continue; -+ if ((strlen("GENTOO_PYTHON_PROCESS_NAME") == (int)(p-*e) && strncmp("GENTOO_PYTHON_PROCESS_NAME", *e, (int)(p-*e)) == 0) || -+ (strlen("GENTOO_PYTHON_TARGET_SCRIPT_PATH") == (int)(p-*e) && strncmp("GENTOO_PYTHON_TARGET_SCRIPT_PATH", *e, (int)(p-*e)) == 0) || -+ (strlen("GENTOO_PYTHON_WRAPPER_SCRIPT_PATH") == (int)(p-*e) && strncmp("GENTOO_PYTHON_WRAPPER_SCRIPT_PATH", *e, (int)(p-*e)) == 0)) -+ continue; - k = PyBytes_FromStringAndSize(*e, (int)(p-*e)); - if (k == NULL) { - PyErr_Clear(); ---- Modules/python.c -+++ Modules/python.c -@@ -7,6 +7,14 @@ - #include <floatingpoint.h> - #endif - -+#ifdef __linux__ -+#include <linux/prctl.h> -+#include <sys/prctl.h> -+#ifndef PR_SET_NAME -+#define PR_SET_NAME 15 -+#endif -+#endif -+ - #ifdef MS_WINDOWS - int - wmain(int argc, wchar_t **argv) -@@ -44,6 +52,11 @@ - fpsetmask(m & ~FP_X_OFL); - #endif - -+ if (getenv("GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION")) { -+ printf("GENTOO_PYTHON_TARGET_SCRIPT_PATH supported\n"); -+ return 0; -+ } -+ - oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL)); - if (!oldloc) { - fprintf(stderr, "out of memory\n"); -@@ -66,6 +79,18 @@ - - setlocale(LC_ALL, oldloc); - PyMem_RawFree(oldloc); -+ -+#ifdef __linux__ -+ { -+ char *process_name = getenv("GENTOO_PYTHON_PROCESS_NAME"); -+#ifdef HAVE_UNSETENV -+ unsetenv("GENTOO_PYTHON_PROCESS_NAME"); -+#endif -+ if (process_name != NULL && *process_name != '\0') -+ prctl(PR_SET_NAME, process_name); -+ } -+#endif -+ - res = Py_Main(argc, argv_copy); - for (i = 0; i < argc; i++) { - PyMem_RawFree(argv_copy2[i]); ---- Python/sysmodule.c -+++ Python/sysmodule.c -@@ -1852,6 +1852,10 @@ - makeargvobject(int argc, wchar_t **argv) - { - PyObject *av; -+ char *wrapper_script_name = getenv("GENTOO_PYTHON_WRAPPER_SCRIPT_PATH"); -+#ifdef HAVE_UNSETENV -+ unsetenv("GENTOO_PYTHON_WRAPPER_SCRIPT_PATH"); -+#endif - if (argc <= 0 || argv == NULL) { - /* Ensure at least one (empty) argument is seen */ - static wchar_t *empty_argv[1] = {L""}; -@@ -1862,7 +1866,16 @@ - if (av != NULL) { - int i; - for (i = 0; i < argc; i++) { -- PyObject *v = PyUnicode_FromWideChar(argv[i], -1); -+ PyObject *v = NULL; -+ if (i == 0 && wrapper_script_name != NULL && *wrapper_script_name != '\0') { -+ size_t length = strlen(wrapper_script_name); -+ wchar_t *wcs_wrapper_script_name = (wchar_t *) calloc(length + 1, sizeof(wchar_t)); -+ if (mbstowcs(wcs_wrapper_script_name, wrapper_script_name, length) >= 0) -+ v = PyUnicode_FromWideChar(wcs_wrapper_script_name, -1); -+ free(wcs_wrapper_script_name); -+ } -+ if (v == NULL) -+ v = PyUnicode_FromWideChar(argv[i], -1); - if (v == NULL) { - Py_DECREF(av); - av = NULL; -@@ -1881,7 +1894,9 @@ - static void - sys_update_path(int argc, wchar_t **argv) - { -- wchar_t *argv0; -+ char *target_script_name = getenv("GENTOO_PYTHON_TARGET_SCRIPT_PATH"); -+ wchar_t *wcs_target_script_name = NULL; -+ wchar_t *argv0 = NULL; - wchar_t *p = NULL; - Py_ssize_t n = 0; - PyObject *a; -@@ -1896,12 +1911,22 @@ - #elif defined(MS_WINDOWS) && !defined(MS_WINCE) - wchar_t fullpath[MAX_PATH]; - #endif -+#ifdef HAVE_UNSETENV -+ unsetenv("GENTOO_PYTHON_TARGET_SCRIPT_PATH"); -+#endif - - path = _PySys_GetObjectId(&PyId_path); - if (path == NULL) - return; - -- argv0 = argv[0]; -+ if (target_script_name != NULL && *target_script_name != '\0') { -+ size_t length = strlen(target_script_name); -+ wcs_target_script_name = (wchar_t *) calloc(length + 1, sizeof(wchar_t)); -+ if (mbstowcs(wcs_target_script_name, target_script_name, length) >= 0) -+ argv0 = wcs_target_script_name; -+ } -+ if (argv0 == NULL) -+ argv0 = argv[0]; - - #ifdef HAVE_READLINK - if (_HAVE_SCRIPT_ARGUMENT(argc, argv)) -@@ -1978,6 +2003,7 @@ - if (PyList_Insert(path, 0, a) < 0) - Py_FatalError("sys.path.insert(0) failed"); - Py_DECREF(a); -+ free(wcs_target_script_name); - } - - void |