1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
From 0b407e11fe0bae4707286ab3cbf6a7a72a906817 Mon Sep 17 00:00:00 2001
From: "Mark E. Fuller" <mark.e.fuller@gmx.de>
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 = []
|