Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit12eeb3e

Browse files
Remove -Werror=unguarded-availability-new from sysconfig data (astral-sh#422)
## SummaryPerastral-sh#210, we now strip `-Werror=unguarded-availability-new` from `CFLAGS` and `CPPFLAGS` (but not, e.g., `CONFIGURE_CFLAGS`).Closesastral-sh#210.
1 parentba4532d commit12eeb3e

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

‎cpython-unix/build-cpython.sh‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,26 @@ def replace_in_all(search, replace):
644644
replace_in_file(SYSCONFIGDATA, search, replace)
645645
646646
647+
def replace_in_sysconfigdata(search, replace, keys):
648+
"""Replace a string in the sysconfigdata file for select keys."""
649+
with open(SYSCONFIGDATA, "rb") as fh:
650+
data = fh.read()
651+
652+
globals_dict = {}
653+
locals_dict = {}
654+
exec(data, globals_dict, locals_dict)
655+
build_time_vars = locals_dict['build_time_vars']
656+
657+
for key in keys:
658+
if key in build_time_vars:
659+
build_time_vars[key] = build_time_vars[key].replace(search, replace)
660+
661+
with open(SYSCONFIGDATA, "wb") as fh:
662+
fh.write(b'# system configuration generated and used by the sysconfig module\n')
663+
fh.write(('build_time_vars = %s' % json.dumps(build_time_vars, indent=4, sort_keys=True)).encode("utf-8"))
664+
fh.close()
665+
666+
647667
def format_sysconfigdata():
648668
"""Reformat the sysconfigdata file to avoid implicit string concatenations.
649669
@@ -670,6 +690,18 @@ def format_sysconfigdata():
670690
# Format sysconfig to ensure that string replacements take effect.
671691
format_sysconfigdata()
672692
693+
# Remove`-Werror=unguarded-availability-new` from`CFLAGS` and`CPPFLAGS`.
694+
# These flags are passed along when building extension modules. In that context,
695+
#`-Werror=unguarded-availability-new` can cause builds that would otherwise
696+
# succeed to fail. While the issues raised by`-Werror=unguarded-availability-new`
697+
# are legitimate, enforcing them in extension modules is stricter than CPython's
698+
# own behavior.
699+
replace_in_sysconfigdata(
700+
"-Werror=unguarded-availability-new",
701+
"",
702+
["CFLAGS", "CPPFLAGS"],
703+
)
704+
673705
# Remove the Xcode path from the compiler flags.
674706
#
675707
# CPython itself will drop this from`sysconfig.get_config_var("CFLAGS")` and

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp