Skip to content

Commit de91842

Browse files
drexinglessard
andauthored
[Build] Update scripts to use dyld_info (#60532)
* [Build] Update scripts to use dyld_info dyldinfo has been deprecated and will no longer be available on newer Xcode releases. It has been replaced with dyld_info. To stay compatible with older releases, we are still falling back to dyldinfo, if dyld_info is not available. rdar://98570807 * Apply suggestions from code review Co-authored-by: Guillaume Lessard <[email protected]> * Apply suggestions from code review Co-authored-by: Guillaume Lessard <[email protected]>
1 parent 590caf9 commit de91842

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

utils/swift-darwin-postprocess.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,17 @@ def main(arguments):
3131
# with runpath-relative loads of system libraries on some dyld versions.
3232
# (rdar://78851265)
3333
def unrpathize(filename):
34-
dylibsOutput = subprocess.check_output(
35-
['xcrun', 'dyldinfo', '-dylibs', filename],
36-
universal_newlines=True)
34+
dylibsOutput = None
35+
try:
36+
# `dyldinfo` has been replaced with `dyld_info`, so we try it first
37+
# before falling back to `dyldinfo`
38+
dylibsOutput = subprocess.check_output(
39+
['xcrun', 'dyld_info', '-dependents', filename],
40+
universal_newlines=True)
41+
except subprocess.CalledProcessError:
42+
dylibsOutput = subprocess.check_output(
43+
['xcrun', 'dyldinfo', '-dylibs', filename],
44+
universal_newlines=True)
3745

3846
# Do not rewrite @rpath-relative load commands for these libraries:
3947
# they are test support libraries that are never installed under

utils/swift-rpathize.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,18 @@ def main(arguments):
5454

5555

5656
def rpathize(filename):
57-
dylibsOutput = subprocess.check_output(
58-
['xcrun', 'dyldinfo', '-dylibs', filename],
59-
universal_newlines=True)
57+
dylibsOutput = None
58+
59+
try:
60+
# `dyldinfo` has been replaced with `dyld_info`, so we try it first
61+
# before falling back to `dyldinfo`
62+
dylibsOutput = subprocess.check_output(
63+
['xcrun', 'dyld_info', '-dependents', filename],
64+
universal_newlines=True)
65+
except subprocess.CalledProcessError:
66+
dylibsOutput = subprocess.check_output(
67+
['xcrun', 'dyldinfo', '-dylibs', filename],
68+
universal_newlines=True)
6069

6170
# The output from dyldinfo -dylibs is a line of header followed by one
6271
# install name per line, indented with spaces.

0 commit comments

Comments
 (0)