View | Details | Raw Unified | Return to bug 271961
Collapse All | Expand All

(-)b/lang/tauthon/files/patch-setup.py (-17 / +56 lines)
Lines 1-13 Link Here
1
# Description: Partial script installation backport from Python3
1
--- setup.py.orig	2021-06-02 16:51:18.000000000 +0200
2
# Submitted by: mva
2
+++ setup.py	2023-06-09 19:32:17.812240000 +0200
3
3
@@ -15,6 +15,7 @@
4
# Description: Some modules are installed via other ports
5
6
# Description: ossaudiodev detection fix backport
7
8
--- setup.py.orig	2017-04-22 03:42:03 UTC
9
+++ setup.py
10
@@ -15,6 +15,7 @@ from distutils.core import Extension, se
11
 from distutils.command.build_ext import build_ext
4
 from distutils.command.build_ext import build_ext
12
 from distutils.command.install import install
5
 from distutils.command.install import install
13
 from distutils.command.install_lib import install_lib
6
 from distutils.command.install_lib import install_lib
Lines 15-21 Link Here
15
 from distutils.spawn import find_executable
8
 from distutils.spawn import find_executable
16
 
9
 
17
 cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ
10
 cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ
18
@@ -33,7 +34,7 @@ host_platform = get_platform()
11
@@ -33,7 +34,7 @@
19
 COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
12
 COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
20
 
13
 
21
 # This global variable is used to hold the list of modules to be disabled.
14
 # This global variable is used to hold the list of modules to be disabled.
Lines 24-30 Link Here
24
 
17
 
25
 def add_dir_to_list(dirlist, dir):
18
 def add_dir_to_list(dirlist, dir):
26
     """Add the directory 'dir' to the list 'dirlist' (at the front) if
19
     """Add the directory 'dir' to the list 'dirlist' (at the front) if
27
@@ -1234,7 +1235,7 @@ class PyBuildExt(build_ext):
20
@@ -886,7 +887,10 @@
21
             missing.append('_ssl')
22
 
23
         # find out which version of OpenSSL we have
24
+        openssl_major = -1
25
         openssl_ver = 0
26
+        openssl_major_re = re.compile(
27
+            '^\s*#\s*define\s+OPENSSL_VERSION_MAJOR\s+([0-9]+)' )
28
         openssl_ver_re = re.compile(
29
             '^\s*#\s*define\s+OPENSSL_VERSION_NUMBER\s+(0x[0-9a-fA-F]+)' )
30
 
31
@@ -900,17 +904,22 @@
32
             try:
33
                 incfile = open(name, 'r')
34
                 for line in incfile:
35
+                    m = openssl_major_re.match(line)
36
+                    if m:
37
+                        openssl_major = int(m.group(1))
38
                     m = openssl_ver_re.match(line)
39
                     if m:
40
-                        openssl_ver = eval(m.group(1))
41
+                        openssl_ver = int(m.group(1), 0)
42
             except IOError, msg:
43
                 print "IOError while reading opensshv.h:", msg
44
                 pass
45
 
46
+        min_openssl_major = 1
47
         min_openssl_ver = 0x00907000
48
         have_any_openssl = ssl_incs is not None and ssl_libs is not None
49
         have_usable_openssl = (have_any_openssl and
50
-                               openssl_ver >= min_openssl_ver)
51
+                               (openssl_ver >= min_openssl_ver or
52
+                                openssl_major >= min_openssl_major))
53
 
54
         if have_any_openssl:
55
             if have_usable_openssl:
56
@@ -935,7 +944,9 @@
57
                             depends = ['md5.h']) )
58
 
59
         min_sha2_openssl_ver = 0x00908000
60
-        if COMPILED_WITH_PYDEBUG or openssl_ver < min_sha2_openssl_ver:
61
+        if COMPILED_WITH_PYDEBUG or \
62
+           (openssl_ver < min_sha2_openssl_ver and
63
+            openssl_major < min_openssl_major):
64
             # OpenSSL doesn't do these until 0.9.8 so we'll bring our own hash
65
             exts.append( Extension('_sha256', ['sha256module.c']) )
66
             exts.append( Extension('_sha512', ['sha512module.c']) )
67
@@ -1284,7 +1295,7 @@
28
                 sysroot = macosx_sdk_root()
68
                 sysroot = macosx_sdk_root()
29
                 f = os.path.join(sysroot, f[1:])
69
                 f = os.path.join(sysroot, f[1:])
30
 
70
 
Lines 33-39 Link Here
33
             data = open(f).read()
73
             data = open(f).read()
34
             m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
74
             m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
35
             if m is not None:
75
             if m is not None:
36
@@ -1624,9 +1625,10 @@ class PyBuildExt(build_ext):
76
@@ -1669,9 +1680,10 @@
37
         else:
77
         else:
38
             missing.append('linuxaudiodev')
78
             missing.append('linuxaudiodev')
39
 
79
 
Lines 47-53 Link Here
47
             exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
87
             exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
48
         else:
88
         else:
49
             missing.append('ossaudiodev')
89
             missing.append('ossaudiodev')
50
@@ -2200,6 +2202,22 @@ class PyBuildInstallLib(install_lib):
90
@@ -2294,6 +2306,22 @@
51
     def is_chmod_supported(self):
91
     def is_chmod_supported(self):
52
         return hasattr(os, 'chmod')
92
         return hasattr(os, 'chmod')
53
 
93
 
Lines 70-76 Link Here
70
 SUMMARY = """
110
 SUMMARY = """
71
 Python is an interpreted, interactive, object-oriented programming
111
 Python is an interpreted, interactive, object-oriented programming
72
 language. It is often compared to Tcl, Perl, Scheme or Java.
112
 language. It is often compared to Tcl, Perl, Scheme or Java.
73
@@ -2245,7 +2263,9 @@ def main():
113
@@ -2343,7 +2371,9 @@
74
           platforms = ["Many"],
114
           platforms = ["Many"],
75
 
115
 
76
           # Build info
116
           # Build info
Lines 81-87 Link Here
81
                       'install_lib':PyBuildInstallLib},
121
                       'install_lib':PyBuildInstallLib},
82
           # The struct module is defined here, because build_ext won't be
122
           # The struct module is defined here, because build_ext won't be
83
           # called unless there's at least one extension module defined.
123
           # called unless there's at least one extension module defined.
84
@@ -2253,8 +2273,7 @@ def main():
124
@@ -2351,8 +2381,7 @@
85
 
125
 
86
           # Scripts to install
126
           # Scripts to install
87
           scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle',
127
           scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle',
88
- 

Return to bug 271961