Drop deprecated 'U' open option for compatibility with Python 3.11
https://github.com/Cantera/cantera/commit/0b407e11fe0bae4707286ab3cbf6a7a72a906817
|
|
|
12 | 12 | |
13 | 13 | from SCons.Script import * |
14 | 14 | import SCons.Errors |
15 | | |
| 15 | from pathlib import Path |
16 | 16 | |
17 | 17 | # Helper/core functions |
18 | 18 | ############################################################################## |
… |
… |
|
20 | 20 | # Do the substitution |
21 | 21 | def _subst_file(target, source, env, pattern, replace): |
22 | 22 | # Read file |
23 | | #print 'CALLING SUBST_FILE' |
24 | | f = open(source, "rU") |
25 | | try: |
26 | | contents = f.read() |
27 | | finally: |
28 | | f.close() |
| 23 | contents = Path(source).read_text() |
29 | 24 | |
30 | 25 | # Substitute, make sure result is a string |
31 | 26 | def subfn(mo): |
… |
… |
def subfn(mo): |
46 | 41 | # Determine which keys are used |
47 | 42 | def _subst_keys(source, pattern): |
48 | 43 | # Read file |
49 | | f = open(source, "rU") |
50 | | try: |
51 | | contents = f.read() |
52 | | finally: |
53 | | f.close() |
| 44 | contents = Path(source).read_text() |
54 | 45 | |
55 | 46 | # Determine keys |
56 | 47 | keys = [] |