Newer
Older
#! /usr/bin/python
import sys
filename=sys.argv[1]
address=sys.argv[2]
import re
Bernhard F.W. Gschaider
committed
from os import environ,path
Bernhard F.W. Gschaider
committed
fullFile=None
if path.exists(filename):
fullFile=filename
Bernhard F.W. Gschaider
committed
for v in ["PATH","LD_LIBRARY_PATH"]:
if not v in environ:
continue
Bernhard F.W. Gschaider
committed
if not fullFile:
for d in environ[v].split(':'):
if path.exists(path.join(d,filename)):
fullFile=path.join(d,filename)
break
Bernhard F.W. Gschaider
committed
if not fullFile:
fullFile=filename
answer="??:0"
Bernhard F.W. Gschaider
committed
if path.exists(fullFile):
import subprocess
result=subprocess.Popen(["xcrun", "atos",
"-o",fullFile,
address],
stdout=subprocess.PIPE
).communicate()[0]
match=re.compile('.+ \((.+)\) \((.+)\)').match(result)
if match:
answer=match.group(2)+" "+match.group(1)
else:
import os
result=subprocess.Popen(["xcrun", "atos",
"-p",str(os.getppid()),
address],
stdout=subprocess.PIPE
).communicate()[0]
match=re.compile('.+ \((.+)\) \((.+)\)').match(result)
if match:
answer=match.group(2)+" "+match.group(1)
print answer,
sys.exit(255)