aboutsummaryrefslogtreecommitdiff
blob: af735be0bba6bca09c6e90e95b98ab342fd83e11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--- setup.py
+++ setup.py
@@ -31,7 +31,17 @@
 COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
 
 # This global variable is used to hold the list of modules to be disabled.
-disabled_module_list = []
+pdm_env = "PYTHON_DISABLE_MODULES"
+if pdm_env in os.environ:
+    disabled_module_list = os.environ[pdm_env].split()
+else:
+    disabled_module_list = []
+
+pds_env = "PYTHON_DISABLE_SSL"
+if pds_env in os.environ:
+    disable_ssl = os.environ[pds_env]
+else:
+    disable_ssl = 0
 
 def add_dir_to_list(dirlist, dir):
     """Add the directory 'dir' to the list 'dirlist' (after any relative
@@ -435,6 +445,7 @@
             os.unlink(tmpfile)
 
     def detect_modules(self):
+        global disable_ssl
         # Ensure that /usr/local is always used, but the local build
         # directories (i.e. '.' and 'Include') must be first.  See issue
         # 10520.
@@ -747,7 +758,7 @@
         ssl_incs = find_file('openssl/ssl.h', inc_dirs,
                              search_for_ssl_incs_in
                              )
-        if ssl_incs is not None:
+        if ssl_incs is not None and not disable_ssl:
             krb5_h = find_file('krb5.h', inc_dirs,
                                ['/usr/kerberos/include'])
             if krb5_h:
@@ -758,7 +769,8 @@
                                      ] )
 
         if (ssl_incs is not None and
-            ssl_libs is not None):
+            ssl_libs is not None and
+            not disable_ssl):
             exts.append( Extension('_ssl', ['_ssl.c'],
                                    include_dirs = ssl_incs,
                                    library_dirs = ssl_libs,
@@ -791,7 +803,7 @@
 
         #print('openssl_ver = 0x%08x' % openssl_ver)
         min_openssl_ver = 0x00907000
-        have_any_openssl = ssl_incs is not None and ssl_libs is not None
+        have_any_openssl = ssl_incs is not None and ssl_libs is not None and not disable_ssl
         have_usable_openssl = (have_any_openssl and
                                openssl_ver >= min_openssl_ver)