File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -45,10 +45,20 @@ jobs:
4545 fail-fast : false
4646 matrix :
4747 build :
48+ - target_triple : ' aarch64-apple-darwin'
49+ runner : macos-14
50+ py : ' cpython-3.9'
51+ options : ' debug'
52+
53+ - target_triple : ' aarch64-apple-darwin'
54+ runner : macos-14
55+ py : ' cpython-3.12'
56+ options : ' debug'
57+
4858 - target_triple : ' aarch64-apple-darwin'
4959 runner : macos-14
5060 py : ' cpython-3.13'
51- options : ' freethreaded+ debug'
61+ options : ' debug'
5262 needs :
5363 - pythonbuild
5464 runs-on : ${{ matrix.build.runner }}
Original file line number Diff line number Diff line change @@ -627,6 +627,33 @@ def replace_in_all(search, replace):
627627 replace_in_file(MAKEFILE, search, replace)
628628 replace_in_file(SYSCONFIGDATA, search, replace)
629629
630+
631+ def format_sysconfigdata():
632+ """Reformat the sysconfigdata file to avoid implicit string concatenations.
633+
634+ In some Python versions, the sysconfigdata file contains implicit string
635+ concatenations that extend over multiple lines, which make string replacement
636+ much harder. This function reformats the file to avoid this issue.
637+
638+ See: https://github.com/python/cpython/blob/a03efb533a58fd13fb0cc7f4a5c02c8406a407bd/Mac/BuildScript/build-installer.py#L1360C1-L1385C15.
639+ """
640+ with open(SYSCONFIGDATA, "rb") as fh:
641+ data = fh.read()
642+
643+ globals_dict = {}
644+ locals_dict = {}
645+ exec(data, globals_dict, locals_dict)
646+ build_time_vars = l_dict['build_time_vars']
647+
648+ with open(SYSCONFIGDATA, "wb") as fh:
649+ fh.write(b'# system configuration generated and used by the sysconfig module\n')
650+ fh.write(('build_time_vars = %s' % json.dumps(build_time_vars, indent=4)).encode("utf-8"))
651+ fh.close()
652+
653+
654+ # Format sysconfig to ensure that string replacements take effect.
655+ format_sysconfigdata()
656+
630657# Remove the Xcode path from the compiler flags.
631658#
632659# CPython itself will drop this from ` sysconfig.get_config_var(" CFLAGS" )` and
You can’t perform that action at this time.
0 commit comments