From 0b407e11fe0bae4707286ab3cbf6a7a72a906817 Mon Sep 17 00:00:00 2001 From: "Mark E. Fuller" Date: Thu, 23 Jun 2022 00:04:22 +0300 Subject: [PATCH] drop deprecated 'U' open option --- site_scons/site_tools/subst.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/site_scons/site_tools/subst.py b/site_scons/site_tools/subst.py index 3a1c4f6fb8..05d520491b 100644 --- a/site_scons/site_tools/subst.py +++ b/site_scons/site_tools/subst.py @@ -12,7 +12,7 @@ from SCons.Script import * import SCons.Errors - +from pathlib import Path # Helper/core functions ############################################################################## @@ -20,12 +20,7 @@ # Do the substitution def _subst_file(target, source, env, pattern, replace): # Read file - #print 'CALLING SUBST_FILE' - f = open(source, "rU") - try: - contents = f.read() - finally: - f.close() + contents = Path(source).read_text() # Substitute, make sure result is a string def subfn(mo): @@ -46,11 +41,7 @@ def subfn(mo): # Determine which keys are used def _subst_keys(source, pattern): # Read file - f = open(source, "rU") - try: - contents = f.read() - finally: - f.close() + contents = Path(source).read_text() # Determine keys keys = []