def main(argv): try: java_home = os.getenv("JAVA_HOME", "") path = os.getenv("PATH", "") if java_home: pathsep = os.pathsep if sys.platform == 'cygwin': pathsep = ';' os.environ["PATH"] = os.path.join(java_home, 'bin') + pathsep + path tracing_dir = None build_id = str(uuid.uuid4()) with Tracing("main"): with BuckProject.from_current_dir() as project: tracing_dir = os.path.join(project.get_buck_out_log_dir(), 'traces') # Try to detect if we're running a PEX by checking if we were invoked # via a zip file. if zipfile.is_zipfile(argv[0]): from buck_package import BuckPackage buck_repo = BuckPackage(project) else: from buck_repo import BuckRepo buck_repo = BuckRepo(THIS_DIR, project) return buck_repo.launch_buck(build_id) finally: if tracing_dir: Tracing.write_to_dir(tracing_dir, build_id)
def main(argv): install_signal_handlers() try: java_home = os.getenv("JAVA_HOME", "") path = os.getenv("PATH", "") if java_home: pathsep = os.pathsep os.environ["PATH"] = os.path.join(java_home, 'bin') + pathsep + path tracing_dir = None build_id = str(uuid.uuid4()) with Tracing("main"): with BuckProject.from_current_dir() as project: tracing_dir = os.path.join(project.get_buck_out_log_dir(), 'traces') # Try to detect if we're running a PEX by checking if we were invoked # via a zip file. if zipfile.is_zipfile(argv[0]): from buck_package import BuckPackage buck_repo = BuckPackage(project) else: from buck_repo import BuckRepo buck_repo = BuckRepo(THIS_DIR, project) # If 'kill' is the second argument, shut down the buckd process. if sys.argv[1:] == ['kill']: buck_repo.kill_buckd() return 0 return buck_repo.launch_buck(build_id) finally: if tracing_dir: Tracing.write_to_dir(tracing_dir, build_id)
def main(argv): with BuckProject.from_current_dir() as project: # Try to detect if we're running a PEX by checking if we were invoked # via a zip file. if zipfile.is_zipfile(argv[0]): from buck_package import BuckPackage buck_repo = BuckPackage(project) else: from buck_repo import BuckRepo buck_repo = BuckRepo(THIS_DIR, project) if '--help' in argv: print("Specify --kill to kill buckd.", file=sys.stderr) return 0 buck_repo.kill_buckd() if '--kill' in sys.argv: return 0 return buck_repo.launch_buckd()
def get_repo(p): # Try to detect if we're running a PEX by checking if we were invoked # via a zip file. if zipfile.is_zipfile(argv[0]): from buck_package import BuckPackage return BuckPackage(p) else: from buck_repo import BuckRepo return BuckRepo(THIS_DIR, p)