Ticket #69362: python311.patch

File python311.patch, 1.1 KB (added by ryandesign (Ryan Carsten Schmidt), 6 months ago)
  • site_scons/site_tools/subst.py

    Drop deprecated 'U' open option for compatibility with Python 3.11
    https://github.com/Cantera/cantera/commit/0b407e11fe0bae4707286ab3cbf6a7a72a906817
     
    1212
    1313from SCons.Script import *
    1414import SCons.Errors
    15 
     15from pathlib import Path
    1616
    1717# Helper/core functions
    1818##############################################################################
     
    2020# Do the substitution
    2121def _subst_file(target, source, env, pattern, replace):
    2222    # 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()
    2924
    3025    # Substitute, make sure result is a string
    3126    def subfn(mo):
    def subfn(mo): 
    4641# Determine which keys are used
    4742def _subst_keys(source, pattern):
    4843    # Read file
    49     f = open(source, "rU")
    50     try:
    51         contents = f.read()
    52     finally:
    53         f.close()
     44    contents = Path(source).read_text()
    5445
    5546    # Determine keys
    5647    keys = []