Skip to content

Commit 52e64a1

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

File tree

5 files changed

+10
-99
lines changed

5 files changed

+10
-99
lines changed

.github/workflows/apple.yml

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -49,66 +49,26 @@ jobs:
4949
runner: macos-14
5050
py: 'cpython-3.9'
5151
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'
6052

6153
- target_triple: 'aarch64-apple-darwin'
6254
runner: macos-14
6355
py: 'cpython-3.10'
6456
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'
7357

7458
- target_triple: 'aarch64-apple-darwin'
7559
runner: macos-14
7660
py: 'cpython-3.11'
7761
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'
8662

8763
- target_triple: 'aarch64-apple-darwin'
8864
runner: macos-14
8965
py: 'cpython-3.12'
9066
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'
9967

10068
- target_triple: 'aarch64-apple-darwin'
10169
runner: macos-14
10270
py: 'cpython-3.13'
10371
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'
11272

11373
- target_triple: 'aarch64-apple-darwin'
11474
runner: macos-14
@@ -130,66 +90,26 @@ jobs:
13090
runner: macos-13
13191
py: 'cpython-3.9'
13292
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'
14193

14294
- target_triple: 'x86_64-apple-darwin'
14395
runner: macos-13
14496
py: 'cpython-3.10'
14597
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'
15498

15599
- target_triple: 'x86_64-apple-darwin'
156100
runner: macos-13
157101
py: 'cpython-3.11'
158102
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'
167103

168104
- target_triple: 'x86_64-apple-darwin'
169105
runner: macos-13
170106
py: 'cpython-3.12'
171107
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'
180108

181109
- target_triple: 'x86_64-apple-darwin'
182110
runner: macos-13
183111
py: 'cpython-3.13'
184112
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'
193113
- target_triple: 'x86_64-apple-darwin'
194114
runner: macos-13
195115
py: 'cpython-3.13'

.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)