mirror of https://github.com/Shizmob/smol
try to fix gcc printing localized search dir keys
This commit is contained in:
parent
987bbab3e4
commit
a2e2e8f503
|
@ -71,15 +71,30 @@ def get_needed_syms(readelf_bin, inpfiles):
|
||||||
|
|
||||||
return syms#, needgot
|
return syms#, needgot
|
||||||
|
|
||||||
|
def format_cc_path_line(entry):
|
||||||
|
category, path = entry.split(': ', 1)
|
||||||
|
path = path.lstrip('=')
|
||||||
|
return (category, list(set(os.path.realpath(p) \
|
||||||
|
for p in path.split(':') if os.path.isdir(p))))
|
||||||
|
|
||||||
def get_cc_paths(cc_bin):
|
def get_cc_paths(cc_bin):
|
||||||
|
bak = os.environ.copy()
|
||||||
|
os.environ['LANG'] = "C" # DON'T output localized search dirs!
|
||||||
output = subprocess.check_output([cc_bin, '-print-search-dirs'],
|
output = subprocess.check_output([cc_bin, '-print-search-dirs'],
|
||||||
stderr=subprocess.DEVNULL)
|
stderr=subprocess.DEVNULL)
|
||||||
paths = {}
|
os.environ = bak
|
||||||
for entry in output.decode('utf-8').splitlines():
|
|
||||||
category, path = entry.split(': ', 1)
|
outputpairs = list(map(format_cc_path_line,
|
||||||
path = path.lstrip('=')
|
output.decode('utf-8').splitlines()))
|
||||||
paths[category] = list(set(os.path.realpath(p) \
|
for category, path in outputpairs: paths[category] = path
|
||||||
for p in path.split(':') if os.path.isdir(p)))
|
|
||||||
|
if 'libraries' not in paths: # probably localized... sigh
|
||||||
|
# monkeypatch, assuming order...
|
||||||
|
paths = {}
|
||||||
|
paths['install' ] = outputpairs[0][1]
|
||||||
|
paths['programs' ] = outputpairs[1][1]
|
||||||
|
paths['libraries'] = outputpairs[2][1]
|
||||||
|
|
||||||
return paths
|
return paths
|
||||||
|
|
||||||
def is_valid_elf(f):
|
def is_valid_elf(f):
|
||||||
|
|
Loading…
Reference in New Issue