diff --git a/setup.py b/setup.py
index a46bf35..d6ef5be 100644
--- a/setup.py
+++ b/setup.py
@@ -33,7 +33,10 @@ 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 = []
+try:
+    disabled_module_list = os.environ["PYTHON_DISABLE_MODULES"].split()
+except KeyError:
+    disabled_module_list = []
 
 def add_dir_to_list(dirlist, dir):
     """Add the directory 'dir' to the list 'dirlist' (at the front) if
