Bug 1519603 - Remove the File class in subconfigure.py. r=nalexander
authorMike Hommey <mh+mozilla@glandium.org>
Mon, 14 Jan 2019 18:41:07 +0000
changeset 513857 2809c756574d28c25d031eecd41779d3392c44d4
parent 513856 94f3932b2f958e6c414e3778db4ffb39af42ca8e
child 513858 226b130b6360f05f7329b3a836177af5bb32fd1d
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1519603
milestone66.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 1519603 - Remove the File class in subconfigure.py. r=nalexander The File class is now used only in one place, only for its mtime property, which can be replaced with os.path.getmtime. Depends on D16402 Differential Revision: https://phabricator.services.mozilla.com/D16403
build/subconfigure.py
--- a/build/subconfigure.py
+++ b/build/subconfigure.py
@@ -11,52 +11,16 @@ import os
 import re
 import subprocess
 import sys
 import pickle
 
 import mozpack.path as mozpath
 
 
-class File(object):
-    def __init__(self, path):
-        self._path = path
-        self._content = open(path, 'rb').read()
-        stat = os.stat(path)
-        self._times = (stat.st_atime, stat.st_mtime)
-
-    @property
-    def path(self):
-        return self._path
-
-    @property
-    def mtime(self):
-        return self._times[1]
-
-    @property
-    def modified(self):
-        '''Returns whether the file was modified since the instance was
-        created. Result is memoized.'''
-        if hasattr(self, '_modified'):
-            return self._modified
-
-        modified = True
-        if os.path.exists(self._path):
-            if open(self._path, 'rb').read() == self._content:
-                modified = False
-        self._modified = modified
-        return modified
-
-    def update_time(self):
-        '''If the file hasn't changed since the instance was created,
-           restore its old modification time.'''
-        if not self.modified:
-            os.utime(self._path, self._times)
-
-
 # As defined in the various sub-configures in the tree
 PRECIOUS_VARS = set([
     'build_alias',
     'host_alias',
     'target_alias',
     'CC',
     'CFLAGS',
     'LDFLAGS',
@@ -224,26 +188,25 @@ def run(data):
     # - config.status is older than an input to configure
     # - the configure arguments changed
     # - the environment changed in a way that requires a cache clear.
     configure = mozpath.join(data['srcdir'], 'old-configure')
     config_status_path = mozpath.join(objdir, 'config.status')
     skip_configure = True
     if not os.path.exists(config_status_path):
         skip_configure = False
-        config_status = None
     else:
-        config_status = File(config_status_path)
         config_status_deps = mozpath.join(objdir, 'config_status_deps.in')
         if not os.path.exists(config_status_deps):
             skip_configure = False
         else:
             with open(config_status_deps, 'r') as fh:
                 dep_files = fh.read().splitlines() + [configure]
-            if (any(not os.path.exists(f) or (config_status.mtime < os.path.getmtime(f))
+            if (any(not os.path.exists(f) or
+                    (os.path.getmtime(config_status_path) < os.path.getmtime(f))
                     for f in dep_files) or
                 data.get('previous-args', data['args']) != data['args'] or
                 cleared_cache):
                 skip_configure = False
 
     if not skip_configure:
         # Because configure is a shell script calling a python script
         # calling a shell script, on Windows, with msys screwing the