Backed out changeset 2ed1a0e47b18 (bug 1255585) for Windows build bustage.
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 11 Mar 2016 21:40:08 -0500
changeset 339742 49c270ffc6824b0dd9b1221f28a33fdb744eca78
parent 339741 29ad7ce0f6c39adb537db70d076592dee24cc745
child 339743 82e7e34cedc5698a219cc9275deafd7bdc2be9e1
push id12803
push userjbeich@FreeBSD.org
push dateSun, 13 Mar 2016 09:48:54 +0000
bugs1255585
milestone48.0a1
backs out2ed1a0e47b18714f6d3af196d58250822f84208b
Backed out changeset 2ed1a0e47b18 (bug 1255585) for Windows build bustage. CLOSED TREE
python/mozbuild/mozbuild/virtualenv.py
--- a/python/mozbuild/mozbuild/virtualenv.py
+++ b/python/mozbuild/mozbuild/virtualenv.py
@@ -45,23 +45,16 @@ class VirtualenvManager(object):
 
         Each manager is associated with a source directory, a path where you
         want the virtualenv to be created, and a handle to write output to.
         """
         assert os.path.isabs(manifest_path), "manifest_path must be an absolute path: %s" % (manifest_path)
         self.topsrcdir = topsrcdir
         self.topobjdir = topobjdir
         self.virtualenv_root = virtualenv_path
-
-        # Record the Python executable that was used to create the Virtualenv
-        # so we can check this against sys.executable when verifying the
-        # integrity of the virtualenv.
-        self.exe_info_path = os.path.join(self.virtualenv_root,
-                                          'python_exe.txt')
-
         self.log_handle = log_handle
         self.manifest_path = manifest_path
 
     @property
     def virtualenv_script_path(self):
         """Path to virtualenv's own populator script."""
         return os.path.join(self.topsrcdir, 'python', 'virtualenv',
             'virtualenv.py')
@@ -84,34 +77,16 @@ class VirtualenvManager(object):
             binary += '.exe'
 
         return os.path.join(self.bin_path, binary)
 
     @property
     def activate_path(self):
         return os.path.join(self.bin_path, 'activate_this.py')
 
-    def get_exe_info(self):
-        """Returns the path to python executable that was in use when
-        this virutalenv was created.
-        """
-        with open(self.exe_info_path, 'r') as fh:
-            path, size = fh.read().splitlines()
-        return path, int(size)
-
-    def write_exe_info(self, python):
-        """Records the path to python executable that was in use when
-        this virutalenv was created. We record this explicitly because
-        on OS X our python path may end up being a different or modified
-        executable.
-        """
-        with open(self.exe_info_path, 'w') as fh:
-            fh.write("%s\n" % python)
-            fh.write("%s\n" % os.path.getsize(python))
-
     def up_to_date(self, python=sys.executable):
         """Returns whether the virtualenv is present and up to date."""
 
         deps = [self.manifest_path, __file__]
 
         # check if virtualenv exists
         if not os.path.exists(self.virtualenv_root) or \
             not os.path.exists(self.activate_path):
@@ -119,23 +94,20 @@ class VirtualenvManager(object):
             return False
 
         # check modification times
         activate_mtime = os.path.getmtime(self.activate_path)
         dep_mtime = max(os.path.getmtime(p) for p in deps)
         if dep_mtime > activate_mtime:
             return False
 
-        # Verify that the Python we're checking here is either the virutalenv
-        # python, or is the Python that was used to create the virtualenv.
-        # If this fails, it is likely system Python has been upgraded, and
-        # our virtualenv would not be usable.
-        python_size = os.path.getsize(python)
-        if ((python, python_size) != (self.python_path, os.path.getsize(self.python_path)) and
-            (python, python_size) != self.get_exe_info()):
+        # check interpreter. Assume that a different size is enough to
+        # know whether we've been given a different interpreter, and thus
+        # should refresh the virtualenv.
+        if os.path.getsize(python) != os.path.getsize(self.python_path):
             return False
 
         # recursively check sub packages.txt files
         submanifests = [i[1] for i in self.packages()
                         if i[0] == 'packages.txt']
         for submanifest in submanifests:
             submanifest = os.path.join(self.topsrcdir, submanifest)
             submanager = VirtualenvManager(self.topsrcdir,
@@ -176,18 +148,16 @@ class VirtualenvManager(object):
 
         result = subprocess.call(args, stdout=self.log_handle,
             stderr=subprocess.STDOUT, env=env)
 
         if result:
             raise Exception(
                 'Failed to create virtualenv: %s' % self.virtualenv_root)
 
-        self.write_exe_info(python)
-
         return self.virtualenv_root
 
     def packages(self):
         with file(self.manifest_path, 'rU') as fh:
             packages = [line.rstrip().split(':')
                         for line in fh]
         return packages