From f8f8262fbc351a6a55e43db8412fb1263a2f7b53 Mon Sep 17 00:00:00 2001 From: Mike Gilbert Date: Fri, 5 Jan 2018 13:30:32 -0500 Subject: [PATCH 02/10] Disable modules and SSL --- setup.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index a97a7559ca..16e2db7617 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,17 @@ host_platform = get_platform() 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 @@ -537,6 +547,7 @@ class PyBuildExt(build_ext): 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. @@ -876,11 +887,11 @@ class PyBuildExt(build_ext): depends = ['socketmodule.h']) ) # Detect SSL support for the socket module (via _ssl) ssl_ext, hashlib_ext = self._detect_openssl(inc_dirs, lib_dirs) - if ssl_ext is not None: + if ssl_ext is not None and not disable_ssl: exts.append(ssl_ext) else: missing.append('_ssl') - if hashlib_ext is not None: + if hashlib_ext is not None and not disable_ssl: exts.append(hashlib_ext) else: missing.append('_hashlib') -- 2.18.0