Skip to content

Commit f53f599

Browse files
committed
Use a non-versioned Xcode path in sysconfig
1 parent b0070c6 commit f53f599

File tree

5 files changed

+10
-171
lines changed

5 files changed

+10
-171
lines changed

.github/workflows/apple.yml

Lines changed: 0 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -45,163 +45,11 @@ 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-
- target_triple: 'aarch64-apple-darwin'
53-
runner: macos-14
54-
py: 'cpython-3.9'
55-
options: 'pgo'
56-
- target_triple: 'aarch64-apple-darwin'
57-
runner: macos-14
58-
py: 'cpython-3.9'
59-
options: 'pgo+lto'
60-
61-
- target_triple: 'aarch64-apple-darwin'
62-
runner: macos-14
63-
py: 'cpython-3.10'
64-
options: 'debug'
65-
- target_triple: 'aarch64-apple-darwin'
66-
runner: macos-14
67-
py: 'cpython-3.10'
68-
options: 'pgo'
69-
- target_triple: 'aarch64-apple-darwin'
70-
runner: macos-14
71-
py: 'cpython-3.10'
72-
options: 'pgo+lto'
73-
74-
- target_triple: 'aarch64-apple-darwin'
75-
runner: macos-14
76-
py: 'cpython-3.11'
77-
options: 'debug'
78-
- target_triple: 'aarch64-apple-darwin'
79-
runner: macos-14
80-
py: 'cpython-3.11'
81-
options: 'pgo'
82-
- target_triple: 'aarch64-apple-darwin'
83-
runner: macos-14
84-
py: 'cpython-3.11'
85-
options: 'pgo+lto'
86-
8748
- target_triple: 'aarch64-apple-darwin'
8849
runner: macos-14
8950
py: 'cpython-3.12'
9051
options: 'debug'
91-
- target_triple: 'aarch64-apple-darwin'
92-
runner: macos-14
93-
py: 'cpython-3.12'
94-
options: 'pgo'
95-
- target_triple: 'aarch64-apple-darwin'
96-
runner: macos-14
97-
py: 'cpython-3.12'
98-
options: 'pgo+lto'
99-
100-
- target_triple: 'aarch64-apple-darwin'
101-
runner: macos-14
102-
py: 'cpython-3.13'
103-
options: 'debug'
104-
- target_triple: 'aarch64-apple-darwin'
105-
runner: macos-14
106-
py: 'cpython-3.13'
107-
options: 'pgo'
108-
- target_triple: 'aarch64-apple-darwin'
109-
runner: macos-14
110-
py: 'cpython-3.13'
111-
options: 'pgo+lto'
112-
113-
- target_triple: 'aarch64-apple-darwin'
114-
runner: macos-14
115-
py: 'cpython-3.13'
116-
options: 'freethreaded+debug'
117-
- target_triple: 'aarch64-apple-darwin'
118-
runner: macos-14
119-
py: 'cpython-3.13'
120-
options: 'freethreaded+pgo'
121-
- target_triple: 'aarch64-apple-darwin'
122-
runner: macos-14
123-
py: 'cpython-3.13'
124-
options: 'freethreaded+pgo+lto'
125-
126-
# macOS on Intel hardware. This is pretty straightforward. We exclude
127-
# noopt because it doesn't provide any compelling advantages over PGO
128-
# or LTO builds.
129-
- target_triple: 'x86_64-apple-darwin'
130-
runner: macos-13
131-
py: 'cpython-3.9'
132-
options: 'debug'
133-
- target_triple: 'x86_64-apple-darwin'
134-
runner: macos-13
135-
py: 'cpython-3.9'
136-
options: 'pgo'
137-
- target_triple: 'x86_64-apple-darwin'
138-
runner: macos-13
139-
py: 'cpython-3.9'
140-
options: 'pgo+lto'
141-
142-
- target_triple: 'x86_64-apple-darwin'
143-
runner: macos-13
144-
py: 'cpython-3.10'
145-
options: 'debug'
146-
- target_triple: 'x86_64-apple-darwin'
147-
runner: macos-13
148-
py: 'cpython-3.10'
149-
options: 'pgo'
150-
- target_triple: 'x86_64-apple-darwin'
151-
runner: macos-13
152-
py: 'cpython-3.10'
153-
options: 'pgo+lto'
154-
155-
- target_triple: 'x86_64-apple-darwin'
156-
runner: macos-13
157-
py: 'cpython-3.11'
158-
options: 'debug'
159-
- target_triple: 'x86_64-apple-darwin'
160-
runner: macos-13
161-
py: 'cpython-3.11'
162-
options: 'pgo'
163-
- target_triple: 'x86_64-apple-darwin'
164-
runner: macos-13
165-
py: 'cpython-3.11'
166-
options: 'pgo+lto'
167-
168-
- target_triple: 'x86_64-apple-darwin'
169-
runner: macos-13
170-
py: 'cpython-3.12'
171-
options: 'debug'
172-
- target_triple: 'x86_64-apple-darwin'
173-
runner: macos-13
174-
py: 'cpython-3.12'
175-
options: 'pgo'
176-
- target_triple: 'x86_64-apple-darwin'
177-
runner: macos-13
178-
py: 'cpython-3.12'
179-
options: 'pgo+lto'
18052

181-
- target_triple: 'x86_64-apple-darwin'
182-
runner: macos-13
183-
py: 'cpython-3.13'
184-
options: 'debug'
185-
- target_triple: 'x86_64-apple-darwin'
186-
runner: macos-13
187-
py: 'cpython-3.13'
188-
options: 'pgo'
189-
- target_triple: 'x86_64-apple-darwin'
190-
runner: macos-13
191-
py: 'cpython-3.13'
192-
options: 'pgo+lto'
193-
- target_triple: 'x86_64-apple-darwin'
194-
runner: macos-13
195-
py: 'cpython-3.13'
196-
options: 'freethreaded+debug'
197-
- target_triple: 'x86_64-apple-darwin'
198-
runner: macos-13
199-
py: 'cpython-3.13'
200-
options: 'freethreaded+pgo'
201-
- target_triple: 'x86_64-apple-darwin'
202-
runner: macos-13
203-
py: 'cpython-3.13'
204-
options: 'freethreaded+pgo+lto'
20553
needs:
20654
- pythonbuild
20755
runs-on: ${{ matrix.build.runner }}

.github/workflows/linux.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: Linux Python build
33
on:
44
push:
55
branches: [main]
6-
pull_request:
76

87
concurrency:
98
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}

.github/workflows/windows.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: Windows Python build
33
on:
44
push:
55
branches: [main]
6-
pull_request:
76

87
concurrency:
98
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}

cpython-unix/build-cpython.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,10 @@ def replace_in_all(search, replace):
627627
replace_in_file(MAKEFILE, search, replace)
628628
replace_in_file(SYSCONFIGDATA, search, replace)
629629
630+
# Replace the XCode path with a generic value.
631+
xcode_path = os.getenv("APPLE_SDK_PATH")
632+
if xcode_path:
633+
replace_in_all(xcode_path, "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
630634
631635
# -fdebug-default-version is Clang only. Strip so compiling works on GCC.
632636
replace_in_all("-fdebug-default-version=4", "")

cpython-unix/build.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -165,23 +165,7 @@ def add_target_env(env, build_platform, target_triple, build_env):
165165
# non-system (e.g. Homebrew) executables from being used.
166166
env["PATH"] = "/usr/bin:/bin"
167167

168-
if "APPLE_SDK_PATH" in os.environ:
169-
sdk_path = os.environ["APPLE_SDK_PATH"]
170-
else:
171-
# macOS SDK has historically been in /usr courtesy of an
172-
# installer provided by Xcode. But with Catalina, the files
173-
# are now typically in
174-
# /Applications/Xcode.app/Contents/Developer/Platforms/.
175-
# The proper way to resolve this path is with xcrun, which
176-
# will give us the headers that Xcode is configured to use.
177-
res = subprocess.run(
178-
["xcrun", "--sdk", sdk_platform, "--show-sdk-path"],
179-
check=True,
180-
capture_output=True,
181-
encoding="utf-8",
182-
)
183-
184-
sdk_path = res.stdout.strip()
168+
sdk_path = os.environ["APPLE_SDK_PATH"]
185169

186170
if not os.path.exists(sdk_path):
187171
raise Exception("macOS SDK path %s does not exist" % sdk_path)
@@ -817,6 +801,11 @@ def build_cpython(
817801
if "lto" in parsed_build_options:
818802
env["CPYTHON_LTO"] = "1"
819803

804+
sdk_path = os.environ["APPLE_SDK_PATH"]
805+
if not os.path.exists(sdk_path):
806+
raise Exception("macOS SDK path %s does not exist" % sdk_path)
807+
env["APPLE_SDK_PATH"] = sdk_path
808+
820809
add_target_env(env, host_platform, target_triple, build_env)
821810

822811
build_env.run("build-cpython.sh", environment=env)

0 commit comments

Comments
 (0)