platform_bionic/tools/generate-version-script.py
Elliott Hughes 6b586e7709 Force everything to use python3 for consistency.
Rather than "whatever people have installed as 'python' on their machine".

I've removed check-symbols.py because that's been broken for years and
we never even noticed, and I'm not sure it's worth fixing.

Test: treehugger, manual
Change-Id: Ieb996bbdf790a18d4b1fb46a409cc240ba2a2a49
2021-04-15 13:39:08 -07:00

30 lines
823 B
Python
Executable file

#!/usr/bin/env python3
# This tool is used to generate the version scripts for libc, libm, libdl,
# and libstdc++ for every architecture.
# usage: generate-version-script.py ARCH INPUT OUTPUT
import sys
def has_arch_tags(tags):
for arch in ["arm", "arm64", "x86", "x86_64"]:
if arch in tags:
return True
return False
def GenerateVersionScript(arch, in_filename, out_filename):
with open(out_filename, "w") as fout:
with open(in_filename, "r") as fin:
for line in fin:
index = line.find("#")
if index != -1:
tags = line[index+1:].split()
if arch not in tags and has_arch_tags(tags):
continue
fout.write(line)
arch = sys.argv[1]
in_filename = sys.argv[2]
out_filename = sys.argv[3]
GenerateVersionScript(arch, in_filename, out_filename)