diff --git a/config/Makefile.in b/config/Makefile.in index b0668816aa89..0e340f9c8e25 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -113,7 +113,7 @@ STL_WRAPPERS_SENTINEL = $(DIST)/stl_wrappers/sentinel $(STL_WRAPPERS_SENTINEL): $(srcdir)/make-stl-wrappers.py $(srcdir)/$(stl_compiler)-stl-wrapper.template.h $(srcdir)/stl-headers $(GLOBAL_DEPS) $(PYTHON) $(srcdir)/make-stl-wrappers.py stl_wrappers $(stl_compiler) $(srcdir)/$(stl_compiler)-stl-wrapper.template.h $(srcdir)/stl-headers - $(PYTHON) $(srcdir)/nsinstall.py stl_wrappers $(DIST) + $(PYTHON) $(srcdir)/nsinstall.py -t stl_wrappers $(DIST) touch $(STL_WRAPPERS_SENTINEL) export:: $(STL_WRAPPERS_SENTINEL) diff --git a/config/make-stl-wrappers.py b/config/make-stl-wrappers.py index ebecdf4109dd..6e5f3f7e3cdc 100644 --- a/config/make-stl-wrappers.py +++ b/config/make-stl-wrappers.py @@ -3,6 +3,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. from __future__ import print_function import os, re, string, sys +from mozbuild.util import FileAvoidWrite def find_in_path(file, searchpath): for dir in searchpath.split(os.pathsep): @@ -37,13 +38,10 @@ def main(outdir, compiler, template_file, header_list_file): continue path = header_path(header, compiler) - try: - f = open(os.path.join(outdir, header), 'w') + with FileAvoidWrite(os.path.join(outdir, header)) as f: f.write(string.Template(template).substitute(HEADER=header, HEADER_PATH=path, NEW_HEADER_PATH=path_to_new)) - finally: - f.close() if __name__ == '__main__':