Ticket #62023: python39-changes-from-patch.txt

File python39-changes-from-patch.txt, 13.9 KB (added by kencu (Ken), 4 years ago)
Line 
1diff --git Lib/cgi.py Lib/cgi.py
2index 77ab703..bfe1e7a 100755
3--- Lib/cgi.py
4+++ Lib/cgi.py
5@@ -1,13 +1,6 @@
6-#! /usr/local/bin/python
7-
8-# NOTE: the above "/usr/local/bin/python" is NOT a mistake.  It is
9-# intentionally NOT "/usr/bin/env python".  On many systems
10-# (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI
11-# scripts, and /usr/local/bin is the default directory where Python is
12-# installed, so /usr/bin/env would be unable to find python.  Granted,
13-# binary installations by Linux vendors often install Python in
14-# /usr/bin.  So let those vendors patch cgi.py to match their choice
15-# of installation.
16+#! /opt/local/bin/python3.9
17+
18+# NOTE: /usr/local/bin/python patched for MacPorts installation
19 
20 """Support module for CGI (Common Gateway Interface) scripts.
21 
22diff --git Lib/ctypes/macholib/dyld.py Lib/ctypes/macholib/dyld.py
23index 1c3f8fd..cac41e6 100644
24--- Lib/ctypes/macholib/dyld.py
25+++ Lib/ctypes/macholib/dyld.py
26@@ -28,7 +28,7 @@ DEFAULT_FRAMEWORK_FALLBACK = [
27 
28 DEFAULT_LIBRARY_FALLBACK = [
29     os.path.expanduser("~/lib"),
30-    "/usr/local/lib",
31+    "/opt/local/lib",
32     "/lib",
33     "/usr/lib",
34 ]
35diff --git Makefile.pre.in Makefile.pre.in
36index f128444..85bde2b 100644
37--- Makefile.pre.in
38+++ Makefile.pre.in
39@@ -629,10 +629,10 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
40        esac; \
41        echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
42                _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
43-               $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \
44+               $(PYTHON_FOR_BUILD) $(srcdir)/setup.py --no-user-cfg $$quiet build"; \
45        $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
46                _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
47-               $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
48+               $(PYTHON_FOR_BUILD) $(srcdir)/setup.py --no-user-cfg $$quiet build
49 
50 
51 # Build static library
52@@ -1673,7 +1673,7 @@ libainstall:      @DEF_MAKE_RULE@ python-config
53 # Install the dynamically loadable modules
54 # This goes into $(exec_prefix)
55 sharedinstall: sharedmods
56-       $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
57+       $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py --no-user-cfg install \
58                --prefix=$(prefix) \
59                --install-scripts=$(BINDIR) \
60                --install-platlib=$(DESTSHARED) \
61diff --git Modules/readline.c Modules/readline.c
62index 12d6cc7..c1932da 100644
63--- Modules/readline.c
64+++ Modules/readline.c
65@@ -28,8 +28,7 @@
66 
67 /* GNU readline definitions */
68 #undef HAVE_CONFIG_H /* Else readline/chardefs.h includes strings.h */
69-#include <readline/readline.h>
70-#include <readline/history.h>
71+#include <editline/readline.h>
72 
73 #ifdef HAVE_RL_COMPLETION_MATCHES
74 #define completion_matches(x, y) \
75diff --git configure configure
76index 2d379fe..551d047 100755
77--- configure
78+++ configure
79@@ -3222,6 +3222,8 @@ if test "${enable_framework+set}" = set; then :
80                        ;;
81                esac
82 
83+               FRAMEWORKINSTALLAPPSPREFIX="/Applications/MacPorts"
84+
85                prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
86 
87                # Add files for Mac specific code to the list of output
88@@ -7467,17 +7469,17 @@ $as_echo "$CC" >&6; }
89         then
90             case "$UNIVERSAL_ARCHS" in
91             32-bit)
92-               UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
93+               UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
94                LIPO_32BIT_FLAGS=""
95                ARCH_RUN_32BIT=""
96                ;;
97             64-bit)
98-               UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
99+               UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
100                LIPO_32BIT_FLAGS=""
101                ARCH_RUN_32BIT="true"
102                ;;
103             all)
104-               UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
105+               UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
106                LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
107                ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
108                ;;
109@@ -7487,22 +7489,22 @@ $as_echo "$CC" >&6; }
110                ARCH_RUN_32BIT="true"
111                ;;
112             intel)
113-               UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
114+               UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
115                LIPO_32BIT_FLAGS="-extract i386"
116                ARCH_RUN_32BIT="/usr/bin/arch -i386"
117                ;;
118             intel-32)
119-               UNIVERSAL_ARCH_FLAGS="-arch i386"
120+               UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
121                LIPO_32BIT_FLAGS=""
122                ARCH_RUN_32BIT=""
123                ;;
124             intel-64)
125-               UNIVERSAL_ARCH_FLAGS="-arch x86_64"
126+               UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
127                LIPO_32BIT_FLAGS=""
128                ARCH_RUN_32BIT="true"
129                ;;
130             3-way)
131-               UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
132+               UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
133                LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
134                ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
135                ;;
136@@ -11072,10 +11074,10 @@ else
137       main() {
138         pthread_attr_t attr;
139         pthread_t id;
140-        if (pthread_attr_init(&attr)) exit(-1);
141-        if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
142-        if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
143-        exit(0);
144+        if (pthread_attr_init(&attr)) return (-1);
145+        if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) return (-1);
146+        if (pthread_create(&id, &attr, foo, NULL)) return (-1);
147+        return (0);
148       }
149 _ACEOF
150 if ac_fn_c_try_run "$LINENO"; then :
151@@ -15083,7 +15085,7 @@ else
152   int main()
153   {
154        /* Success: exit code 0 */
155-        exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
156+        return ((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
157   }
158 
159 _ACEOF
160@@ -15464,7 +15466,7 @@ else
161 
162 int main()
163 {
164-       exit(((-1)>>3 == -1) ? 0 : 1);
165+       return (((-1)>>3 == -1) ? 0 : 1);
166 }
167 
168 _ACEOF
169@@ -15541,9 +15543,9 @@ py_cv_lib_readline=no
170 $as_echo_n "checking how to link readline libs... " >&6; }
171 for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do
172   if test -z "$py_libtermcap"; then
173-    READLINE_LIBS="-lreadline"
174+    READLINE_LIBS="-ledit"
175   else
176-    READLINE_LIBS="-lreadline -l$py_libtermcap"
177+    READLINE_LIBS="-ledit -l$py_libtermcap"
178   fi
179   LIBS="$READLINE_LIBS $LIBS_no_readline"
180   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
181@@ -15589,7 +15591,7 @@ fi
182 # check for readline 2.2
183 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
184 /* end confdefs.h.  */
185-#include <readline/readline.h>
186+#include <editline/readline.h>
187 _ACEOF
188 if ac_fn_c_try_cpp "$LINENO"; then :
189   have_readline=yes
190@@ -15602,7 +15604,7 @@ if test $have_readline = yes
191 then
192   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
193 /* end confdefs.h.  */
194-#include <readline/readline.h>
195+#include <editline/readline.h>
196 
197 _ACEOF
198 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
199@@ -15615,7 +15617,7 @@ rm -f conftest*
200 
201   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
202 /* end confdefs.h.  */
203-#include <readline/readline.h>
204+#include <editline/readline.h>
205 
206 _ACEOF
207 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
208@@ -15629,13 +15631,13 @@ rm -f conftest*
209 fi
210 
211 # check for readline 4.0
212-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -lreadline" >&5
213-$as_echo_n "checking for rl_pre_input_hook in -lreadline... " >&6; }
214+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -ledit" >&5
215+$as_echo_n "checking for rl_pre_input_hook in -ledit... " >&6; }
216 if ${ac_cv_lib_readline_rl_pre_input_hook+:} false; then :
217   $as_echo_n "(cached) " >&6
218 else
219   ac_check_lib_save_LIBS=$LIBS
220-LIBS="-lreadline $READLINE_LIBS $LIBS"
221+LIBS="-ledit $READLINE_LIBS $LIBS"
222 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
223 /* end confdefs.h.  */
224 
225@@ -15673,13 +15675,13 @@ fi
226 
227 
228 # also in 4.0
229-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -lreadline" >&5
230-$as_echo_n "checking for rl_completion_display_matches_hook in -lreadline... " >&6; }
231+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -ledit" >&5
232+$as_echo_n "checking for rl_completion_display_matches_hook in -ledit... " >&6; }
233 if ${ac_cv_lib_readline_rl_completion_display_matches_hook+:} false; then :
234   $as_echo_n "(cached) " >&6
235 else
236   ac_check_lib_save_LIBS=$LIBS
237-LIBS="-lreadline $READLINE_LIBS $LIBS"
238+LIBS="-ledit $READLINE_LIBS $LIBS"
239 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
240 /* end confdefs.h.  */
241 
242@@ -15717,13 +15719,13 @@ fi
243 
244 
245 # also in 4.0, but not in editline
246-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_resize_terminal in -lreadline" >&5
247-$as_echo_n "checking for rl_resize_terminal in -lreadline... " >&6; }
248+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_resize_terminal in -ledit" >&5
249+$as_echo_n "checking for rl_resize_terminal in -ledit... " >&6; }
250 if ${ac_cv_lib_readline_rl_resize_terminal+:} false; then :
251   $as_echo_n "(cached) " >&6
252 else
253   ac_check_lib_save_LIBS=$LIBS
254-LIBS="-lreadline $READLINE_LIBS $LIBS"
255+LIBS="-ledit $READLINE_LIBS $LIBS"
256 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
257 /* end confdefs.h.  */
258 
259@@ -15761,13 +15763,13 @@ fi
260 
261 
262 # check for readline 4.2
263-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -lreadline" >&5
264-$as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; }
265+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -ledit" >&5
266+$as_echo_n "checking for rl_completion_matches in -ledit... " >&6; }
267 if ${ac_cv_lib_readline_rl_completion_matches+:} false; then :
268   $as_echo_n "(cached) " >&6
269 else
270   ac_check_lib_save_LIBS=$LIBS
271-LIBS="-lreadline $READLINE_LIBS $LIBS"
272+LIBS="-ledit $READLINE_LIBS $LIBS"
273 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
274 /* end confdefs.h.  */
275 
276@@ -15807,7 +15809,7 @@ fi
277 # also in readline 4.2
278 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
279 /* end confdefs.h.  */
280-#include <readline/readline.h>
281+#include <editline/readline.h>
282 _ACEOF
283 if ac_fn_c_try_cpp "$LINENO"; then :
284   have_readline=yes
285@@ -15820,7 +15822,7 @@ if test $have_readline = yes
286 then
287   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
288 /* end confdefs.h.  */
289-#include <readline/readline.h>
290+#include <editline/readline.h>
291 
292 _ACEOF
293 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
294@@ -15833,13 +15835,13 @@ rm -f conftest*
295 
296 fi
297 
298-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for append_history in -lreadline" >&5
299-$as_echo_n "checking for append_history in -lreadline... " >&6; }
300+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for append_history in -ledit" >&5
301+$as_echo_n "checking for append_history in -ledit... " >&6; }
302 if ${ac_cv_lib_readline_append_history+:} false; then :
303   $as_echo_n "(cached) " >&6
304 else
305   ac_check_lib_save_LIBS=$LIBS
306-LIBS="-lreadline $READLINE_LIBS $LIBS"
307+LIBS="-ledit $READLINE_LIBS $LIBS"
308 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
309 /* end confdefs.h.  */
310 
311@@ -15934,6 +15936,7 @@ else
312 /* end confdefs.h.  */
313 
314 #include <poll.h>
315+#include <unistd.h>
316 
317 int main()
318 {
319@@ -17063,6 +17066,24 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
320     volatile int val = 1;
321     int main() {
322       __atomic_load_n(&val, __ATOMIC_SEQ_CST);
323+
324+      /* https://bugs.python.org/issue24844 */
325+      #define VERSION_CHECK(cc_major, cc_minor, req_major, req_minor) \
326+          ((cc_major) > (req_major) || \
327+          (cc_major) == (req_major) && (cc_minor) >= (req_minor))
328+      #if defined(__clang__)
329+          #if defined(__apple_build_version__)
330+              // either one test or the other should work
331+              // #if __apple_build_version__ < 5000000
332+              #if !VERSION_CHECK(__clang_major__, __clang_minor__, 5, 0)
333+                  #error
334+              #endif
335+          // not sure if this is 3.3 or 3.4
336+          #elif !VERSION_CHECK(__clang_major__, __clang_minor__, 3, 3)
337+              #error
338+          #endif
339+      #endif
340+
341       return 0;
342     }
343 
344diff --git setup.py setup.py
345index bd5f736..3bee673 100644
346--- setup.py
347+++ setup.py
348@@ -44,7 +44,7 @@ from distutils.spawn import find_executable
349 TEST_EXTENSIONS = True
350 
351 # This global variable is used to hold the list of modules to be disabled.
352-DISABLED_MODULE_LIST = []
353+DISABLED_MODULE_LIST = ['_tkinter', '_gdbm']
354 
355 
356 def get_platform():
357@@ -728,9 +728,6 @@ class PyBuildExt(build_ext):
358         # Ensure that /usr/local is always used, but the local build
359         # directories (i.e. '.' and 'Include') must be first.  See issue
360         # 10520.
361-        if not CROSS_COMPILING:
362-            add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
363-            add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
364         # only change this for cross builds for 3.3, issues on Mageia
365         if CROSS_COMPILING:
366             self.add_cross_compiling_paths()
367@@ -963,7 +960,7 @@ class PyBuildExt(build_ext):
368 
369     def detect_readline_curses(self):
370         # readline
371-        do_readline = self.compiler.find_library_file(self.lib_dirs, 'readline')
372+        do_readline = self.compiler.find_library_file(self.lib_dirs, 'edit')
373         readline_termcap_library = ""
374         curses_library = ""
375         # Cannot use os.popen here in py3k.
376@@ -1033,7 +1030,7 @@ class PyBuildExt(build_ext):
377             else:
378                 readline_extra_link_args = ()
379 
380-            readline_libs = ['readline']
381+            readline_libs = ['edit']
382             if readline_termcap_library:
383                 pass # Issue 7384: Already linked against curses or tinfo.
384             elif curses_library:
385@@ -1981,8 +1978,8 @@ class PyBuildExt(build_ext):
386         # Rather than complicate the code below, detecting and building
387         # AquaTk is a separate method. Only one Tkinter will be built on
388         # Darwin - either AquaTk, if it is found, or X11 based Tk.
389-        if (MACOS and self.detect_tkinter_darwin()):
390-            return True
391+        self.announce("INFO: Not using Tcl/Tk", 2)
392+        return False
393 
394         # Assume we haven't found any of the libraries or include files
395         # The versions with dots are used on Unix, and the versions without