vcpkg/ports/tensorflow-common/convert_lib_params_macos.py
Joachim Gehweiler 7734e8b89d
[tensorflow] fix macOS build errors caused by numpy and bazel upgrades (#19363)
* Revert "incorporate changes from microsoft:master"

* Revert "Revert "incorporate changes from microsoft:master""

* issue targeted in newer numpy version

* work-around for broken numpy libs on macOS

* temporarily add debug code to analyze CI failures

* again temporary debug code

* fix linkage command on macOS (broken by Bazel upgrade)

* fix regex for macOS linker command

* remove debug code, bump version

* x-add-version seems to require a separate commit...

* Fix misspelled "acceleration".

* x-add-version

Co-authored-by: jgehw <Joachim_Gehweiler@McAfee.com>
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
2021-09-01 14:29:50 -07:00

19 lines
706 B
Python

import sys
version = sys.argv[1]
lib_suffix = "" if len(sys.argv) < 3 else sys.argv[2]
with open(f"libtensorflow{lib_suffix}.{version}.a-2.params", "w") as f_out:
parts = []
with open(f"libtensorflow_framework.{version}.dylib-2.params", "r") as f_in:
for line in f_in:
if line.startswith("-Wl,-force_load,"):
f_out.write(line[16:])
parts.append(line[16:])
parts = set(parts)
with open(f"libtensorflow{lib_suffix}.{version}.dylib-2.params", "r") as f_in:
for line in f_in:
if line.startswith("-Wl,-force_load,"):
if line[16:] not in parts:
f_out.write(line[16:])