Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/python-gentoo-patches:2.7.9 commit in: patches/
Date: Sat, 07 Feb 2015 21:26:06
Message-Id: 1423343855.28b7cfaff74a00ff46452aece8ccf846d7a84ef2.floppym@gentoo
1 commit: 28b7cfaff74a00ff46452aece8ccf846d7a84ef2
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Sat Feb 7 21:17:35 2015 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 7 21:17:35 2015 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/python-gentoo-patches.git;a=commit;h=28b7cfaf
7
8 Drop 61_all_process_data.patch.
9
10 ---
11 patches/61_all_process_data.patch | 128 --------------------------------------
12 1 file changed, 128 deletions(-)
13
14 diff --git a/patches/61_all_process_data.patch b/patches/61_all_process_data.patch
15 deleted file mode 100644
16 index b0eda4b..0000000
17 --- a/patches/61_all_process_data.patch
18 +++ /dev/null
19 @@ -1,128 +0,0 @@
20 -GENTOO_PYTHON_PROCESS_NAME environmental variable is set by python-wrapper and wrapper scripts generated by
21 -python_generate_wrapper_scripts() and specifies process name.
22 -GENTOO_PYTHON_WRAPPER_SCRIPT_PATH environmental variable is set by wrapper scripts generated by
23 -python_generate_wrapper_scripts() and specifies sys.argv[0] in target executables.
24 -GENTOO_PYTHON_TARGET_SCRIPT_PATH environmental variable is set by wrapper scripts generated by
25 -python_generate_wrapper_scripts() and specifies paths to actually executed scripts.
26 -GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION environmental variable is used by wrapper scripts generated by
27 -python_generate_wrapper_scripts() to check if Python supports GENTOO_PYTHON_TARGET_SCRIPT_PATH environmental variable.
28 -
29 ---- Modules/main.c
30 -+++ Modules/main.c
31 -@@ -252,6 +252,7 @@
32 - int version = 0;
33 - int saw_unbuffered_flag = 0;
34 - PyCompilerFlags cf;
35 -+ char *target_script_name = getenv("GENTOO_PYTHON_TARGET_SCRIPT_PATH");
36 -
37 - cf.cf_flags = 0;
38 -
39 -@@ -486,7 +487,10 @@
40 - filename = argv[_PyOS_optind];
41 -
42 - #else
43 -- filename = argv[_PyOS_optind];
44 -+ if (target_script_name != NULL && *target_script_name != '\0')
45 -+ filename = target_script_name;
46 -+ else
47 -+ filename = argv[_PyOS_optind];
48 - #endif
49 - }
50 -
51 ---- Modules/posixmodule.c
52 -+++ Modules/posixmodule.c
53 -@@ -604,6 +604,10 @@
54 - char *p = strchr(*e, '=');
55 - if (p == NULL)
56 - continue;
57 -+ if ((strlen("GENTOO_PYTHON_PROCESS_NAME") == (int)(p-*e) && strncmp("GENTOO_PYTHON_PROCESS_NAME", *e, (int)(p-*e)) == 0) ||
58 -+ (strlen("GENTOO_PYTHON_TARGET_SCRIPT_PATH") == (int)(p-*e) && strncmp("GENTOO_PYTHON_TARGET_SCRIPT_PATH", *e, (int)(p-*e)) == 0) ||
59 -+ (strlen("GENTOO_PYTHON_WRAPPER_SCRIPT_PATH") == (int)(p-*e) && strncmp("GENTOO_PYTHON_WRAPPER_SCRIPT_PATH", *e, (int)(p-*e)) == 0))
60 -+ continue;
61 - k = PyString_FromStringAndSize(*e, (int)(p-*e));
62 - if (k == NULL) {
63 - PyErr_Clear();
64 ---- Modules/python.c
65 -+++ Modules/python.c
66 -@@ -6,9 +6,22 @@
67 - #include <floatingpoint.h>
68 - #endif
69 -
70 -+#ifdef __linux__
71 -+#include <linux/prctl.h>
72 -+#include <sys/prctl.h>
73 -+#ifndef PR_SET_NAME
74 -+#define PR_SET_NAME 15
75 -+#endif
76 -+#endif
77 -+
78 - int
79 - main(int argc, char **argv)
80 - {
81 -+ if (getenv("GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION")) {
82 -+ printf("GENTOO_PYTHON_TARGET_SCRIPT_PATH supported\n");
83 -+ return 0;
84 -+ }
85 -+
86 - /* 754 requires that FP exceptions run in "no stop" mode by default,
87 - * and until C vendors implement C99's ways to control FP exceptions,
88 - * Python requires non-stop mode. Alas, some platforms enable FP
89 -@@ -20,5 +33,15 @@
90 - m = fpgetmask();
91 - fpsetmask(m & ~FP_X_OFL);
92 - #endif
93 -+
94 -+#ifdef __linux__
95 -+ char *process_name = getenv("GENTOO_PYTHON_PROCESS_NAME");
96 -+#ifdef HAVE_UNSETENV
97 -+ unsetenv("GENTOO_PYTHON_PROCESS_NAME");
98 -+#endif
99 -+ if (process_name != NULL && *process_name != '\0')
100 -+ prctl(PR_SET_NAME, process_name);
101 -+#endif
102 -+
103 - return Py_Main(argc, argv);
104 - }
105 ---- Python/sysmodule.c
106 -+++ Python/sysmodule.c
107 -@@ -1578,6 +1578,10 @@
108 - makeargvobject(int argc, char **argv)
109 - {
110 - PyObject *av;
111 -+ char *wrapper_script_name = getenv("GENTOO_PYTHON_WRAPPER_SCRIPT_PATH");
112 -+#ifdef HAVE_UNSETENV
113 -+ unsetenv("GENTOO_PYTHON_WRAPPER_SCRIPT_PATH");
114 -+#endif
115 - if (argc <= 0 || argv == NULL) {
116 - /* Ensure at least one (empty) argument is seen */
117 - static char *empty_argv[1] = {""};
118 -@@ -1602,7 +1606,11 @@
119 - } else
120 - v = PyString_FromString(argv[i]);
121 - #else
122 -- PyObject *v = PyString_FromString(argv[i]);
123 -+ PyObject *v;
124 -+ if (i == 0 && wrapper_script_name != NULL && *wrapper_script_name != '\0')
125 -+ v = PyString_FromString(wrapper_script_name);
126 -+ else
127 -+ v = PyString_FromString(argv[i]);
128 - #endif
129 - if (v == NULL) {
130 - Py_DECREF(av);
131 -@@ -1630,7 +1638,15 @@
132 - if (PySys_SetObject("argv", av) != 0)
133 - Py_FatalError("can't assign sys.argv");
134 - if (updatepath && path != NULL) {
135 -- char *argv0 = argv[0];
136 -+ char *target_script_name = getenv("GENTOO_PYTHON_TARGET_SCRIPT_PATH");
137 -+#ifdef HAVE_UNSETENV
138 -+ unsetenv("GENTOO_PYTHON_TARGET_SCRIPT_PATH");
139 -+#endif
140 -+ char *argv0;
141 -+ if (target_script_name != NULL && *target_script_name != '\0')
142 -+ argv0 = target_script_name;
143 -+ else
144 -+ argv0 = argv[0];
145 - char *p = NULL;
146 - Py_ssize_t n = 0;
147 - PyObject *a;