1*349cc55cSDimitry Andric#!/usr/bin/env python3 2*349cc55cSDimitry Andric 3*349cc55cSDimitry Andricimport subprocess 4*349cc55cSDimitry Andricimport os 5*349cc55cSDimitry Andricimport sys 6*349cc55cSDimitry Andricimport json 7*349cc55cSDimitry Andric 8*349cc55cSDimitry Andriclldb = os.path.join(os.path.dirname(__file__), 'lldb') 9*349cc55cSDimitry Andric 10*349cc55cSDimitry Andricinfo_json = subprocess.run([lldb, "-l", "python", "-print-script-interpreter-info"], 11*349cc55cSDimitry Andric check=True, stdout=subprocess.PIPE, encoding='utf8').stdout 12*349cc55cSDimitry Andricinfo = json.loads(info_json) 13*349cc55cSDimitry Andric 14*349cc55cSDimitry Andricos.environ["PYTHONPATH"] = ( 15*349cc55cSDimitry Andric info["lldb-pythonpath"] + os.path.pathsep + os.environ.get("PYTHONPATH", "")) 16*349cc55cSDimitry Andric 17*349cc55cSDimitry Andricos.execl(info["executable"], info["executable"], *sys.argv[1:]) 18