Bug 1712382: Remove "set-variable" action support from virtualenvs r=ahal
authorMitchell Hentges <mhentges@mozilla.com>
Thu, 27 May 2021 15:18:36 +0000
changeset 580976 05c9e4f016fdc5536e59c67760e5ec2233990822
parent 580975 922cb1e35a9ecee03da3085e7ec311417512eb42
child 580977 3c8d543d71cf51fd8ff4702cdb6dadc1542f93fd
push id38497
push userapavel@mozilla.com
push dateThu, 27 May 2021 21:28:01 +0000
treeherdermozilla-central@5d03a9d6cb8a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1712382
milestone90.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1712382: Remove "set-variable" action support from virtualenvs r=ahal `MACH_VIRTUALENV` was never used, and `MOZBUILD_VIRTUALENV` was never set (the virtualenv was always activated during the build, rather than before). Differential Revision: https://phabricator.services.mozilla.com/D115921
build/build_virtualenv_packages.txt
build/mach_virtualenv_packages.txt
build/moz.configure/init.configure
python/mozbuild/mozbuild/virtualenv.py
--- a/build/build_virtualenv_packages.txt
+++ b/build/build_virtualenv_packages.txt
@@ -1,3 +1,2 @@
 packages.txt:build/common_virtualenv_packages.txt
 python3:mozilla.pth:third_party/python/glean_parser
-set-variable MOZBUILD_VIRTUALENV=1
--- a/build/mach_virtualenv_packages.txt
+++ b/build/mach_virtualenv_packages.txt
@@ -1,2 +1,1 @@
 packages.txt:build/common_virtualenv_packages.txt
-set-variable MACH_VIRTUALENV=1
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -284,25 +284,19 @@ def virtualenv_python3(env_python, build
     with LineIO(lambda l: log.info(l), "replace") as out:
         manager = VirtualenvManager(
             topsrcdir,
             os.path.join(virtualenvs_root, "common"),
             out,
             os.path.join(topsrcdir, "build", "build_virtualenv_packages.txt"),
         )
 
-    # If we're not in the virtualenv, we need to update the path to include some
-    # necessary modules for find_program.
-    if "MOZBUILD_VIRTUALENV" in os.environ:
-        python = sys.executable
-    else:
-        sys.path.insert(0, os.path.join(topsrcdir, "testing", "mozbase", "mozfile"))
-        sys.path.insert(
-            0, os.path.join(topsrcdir, "third_party", "python", "backports")
-        )
+    # Update the path to include some necessary modules for find_program.
+    sys.path.insert(0, os.path.join(topsrcdir, "testing", "mozbase", "mozfile"))
+    sys.path.insert(0, os.path.join(topsrcdir, "third_party", "python", "backports"))
 
     # If we know the Python executable the caller is asking for then verify its
     # version. If the caller did not ask for a specific executable then find
     # a reasonable default.
     if python:
         found_python = find_program(python)
         if not found_python:
             die(
--- a/python/mozbuild/mozbuild/virtualenv.py
+++ b/python/mozbuild/mozbuild/virtualenv.py
@@ -337,27 +337,16 @@ class VirtualenvManager(VirtualenvHelper
         packages = self.packages()
         python_lib = distutils.sysconfig.get_python_lib()
         do_close = not bool(sitecustomize)
         sitecustomize = sitecustomize or open(
             os.path.join(os.path.dirname(python_lib), "sitecustomize.py"), mode="w"
         )
 
         def handle_package(package):
-            if package[0].startswith("set-variable "):
-                assert len(package) == 1
-                assignment = package[0][len("set-variable ") :].strip()
-                var, val = assignment.split("=", 1)
-                var = var if PY3 else ensure_binary(var)
-                val = val if PY3 else ensure_binary(val)
-                sitecustomize.write(
-                    "import os\n" "os.environ[%s] = %s\n" % (repr(var), repr(val))
-                )
-                return True
-
             if package[0] == "packages.txt":
                 assert len(package) == 2
 
                 src = os.path.join(self.topsrcdir, package[1])
                 assert os.path.isfile(src), "'%s' does not exist" % src
                 submanager = VirtualenvManager(
                     self.topsrcdir,
                     self.virtualenv_root,