Skip to content

Commit f45f3d6

Browse files
committed
build: encoding-robust abi probe (the LANG=C US-ASCII failure)
The linux containers run LANG=C: Open3.capture2e tags the captured bytes US-ASCII, and a UTF-8 punctuation byte in the driver's own stderr diagnostics makes strip raise (Encoding::CompatibilityError) — the gnu legs died at python_build.rb:120 after fully green configure/make/ install/finalize/image-pack. macOS tags UTF-8, which is why only the linux legs saw it. Re-tag UTF-8 + scrub, then take the EXT_SUFFIX- shaped line — stderr noise can never parse as the abi value, and a mismatch still raises the named 106 with the full output in the message.
1 parent d2bf6cc commit f45f3d6

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

‎build/lib/tebako_python_builder/python_build.rb‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,19 @@ def abi
117117
out, st = Open3.capture2e(env, exe_path, "-E", "-c",
118118
"import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX') or '')",
119119
chdir: src_dir)
120-
unless st.exitstatus&.zero? && !out.strip.empty?
120+
# The linux containers run LANG=C: capture2e tags the bytes
121+
# US-ASCII and a UTF-8 punctuation byte from the driver's own
122+
# stderr diagnostics makes strip raise there (macOS tags UTF-8,
123+
# which is why only the linux legs saw it). Re-tag, scrub, and
124+
# keep the EXT_SUFFIX-shaped line — stderr noise never parses.
125+
text = out.force_encoding(Encoding::UTF_8).scrub
126+
line = text.lines.map(&:strip).find { |l| l.match?(/\A\.?cpython-\d+[\w.-]*\z/) }
127+
unless st.exitstatus&.zero? && line
121128
raise TebakoPythonBuilder::Error.new(
122-
"the built interpreter did not report its EXT_SUFFIX (#{st}): #{out}", 106
129+
"the built interpreter did not report its EXT_SUFFIX (#{st}): #{text}", 106
123130
)
124131
end
125-
out.strip.sub(/\A\./, "")
132+
line.sub(/\A\./, "")
126133
end
127134
end
128135

0 commit comments

Comments
 (0)