From 78fecb6128873ebc5ad6cf1d89cdf616818cd6c6 Mon Sep 17 00:00:00 2001 From: Mitchell Hentges Date: Thu, 5 Aug 2021 15:14:18 +0000 Subject: [PATCH] Bug 1720215: Remove MACOSX_DEPLOYMENT_TARGET virtualenv workaround r=firefox-build-system-reviewers,andi Now that the upstream Python bug has been resolved since Python 3.4 (at the latest), we can safely remove the environment variable workaround. Differential Revision: https://phabricator.services.mozilla.com/D119687 --- python/mozbuild/mozbuild/virtualenv.py | 29 +------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/python/mozbuild/mozbuild/virtualenv.py b/python/mozbuild/mozbuild/virtualenv.py index fe587cdd81d0..ac8ee0bf3a22 100644 --- a/python/mozbuild/mozbuild/virtualenv.py +++ b/python/mozbuild/mozbuild/virtualenv.py @@ -315,35 +315,13 @@ class VirtualenvManager(VirtualenvHelper): """ import distutils.sysconfig - # We always target the OS X deployment target that Python itself was - # built with, regardless of what's in the current environment. If we - # don't do this, we may run into a Python bug. See - # http://bugs.python.org/issue9516 and bug 659881. - # - # Note that this assumes that nothing compiled in the virtualenv is - # shipped as part of a distribution. If we do ship anything, the - # deployment target here may be different from what's targeted by the - # shipping binaries and # virtualenv-produced binaries may fail to - # work. - # - # We also ignore environment variables that may have been altered by + # We ignore environment variables that may have been altered by # configure or a mozconfig activated in the current shell. We trust # Python is smart enough to find a proper compiler and to use the # proper compiler flags. If it isn't your Python is likely broken. IGNORE_ENV_VARIABLES = ("CC", "CXX", "CFLAGS", "CXXFLAGS", "LDFLAGS") try: - old_target = os.environ.get("MACOSX_DEPLOYMENT_TARGET", None) - sysconfig_target = distutils.sysconfig.get_config_var( - "MACOSX_DEPLOYMENT_TARGET" - ) - - if sysconfig_target is not None: - # MACOSX_DEPLOYMENT_TARGET is usually a string (e.g.: "10.14.6"), but - # in some cases it is an int (e.g.: 11). Since environment variables - # must all be str, explicitly convert it. - os.environ["MACOSX_DEPLOYMENT_TARGET"] = str(sysconfig_target) - old_env_variables = {} for k in IGNORE_ENV_VARIABLES: if k not in os.environ: @@ -368,11 +346,6 @@ class VirtualenvManager(VirtualenvHelper): self.install_pip_package(pypi_requirement.full_specifier) finally: - os.environ.pop("MACOSX_DEPLOYMENT_TARGET", None) - - if old_target is not None: - os.environ["MACOSX_DEPLOYMENT_TARGET"] = old_target - os.environ.update(old_env_variables) def call_setup(self, directory, arguments):