コード例 #1
0
                    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)


if __name__ == "__main__":
    try:
        propagate_failure(main(sys.argv))
    except RestartBuck:
        os.execvp(os.path.join(os.path.dirname(THIS_DIR), 'bin', 'buck'),
                  sys.argv)
    except (BuckToolException, NailgunException,
            NoBuckConfigFoundException) as e:
        print(str(e), file=sys.stderr)
        sys.exit(1)
    except KeyboardInterrupt:
        # Most shells set exit code to 128 + <Signal Number>
        # So, when catching SIGINT (2), we return 130
        sys.exit(130)
コード例 #2
0
            exit_code = ExitCode.SIGNAL_PIPE
        else:
            exit_code = ExitCode.FATAL_IO
    except KeyboardInterrupt:
        reporter.status_message = "Python wrapper keyboard interrupt"
        exit_code = ExitCode.SIGNAL_INTERRUPT
    except Exception:
        exc_type, exception, exc_traceback = sys.exc_info()
        exit_code = ExitCode.FATAL_BOOTSTRAP

    if exception is not None:
        logging.error(exception, exc_info=(exc_type, exception, exc_traceback))
        if reporter.status_message is None:
            reporter.status_message = str(exception)

    # report result of Buck call
    try:
        reporter.report(exit_code)
    except Exception as e:
        logging.debug(
            "Exception occurred while reporting build results. This error is "
            "benign and doesn't affect the actual build.",
            exc_info=True,
        )

    # execute 'buck run' target
    if fn_exec is not None:
        fn_exec()

    propagate_failure(exit_code)
コード例 #3
0
ファイル: buck.py プロジェクト: dsyang/buck
        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')

                with get_repo(project) as buck_repo:
                    # 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)

if __name__ == "__main__":
    try:
        setup_logging()
        propagate_failure(main(sys.argv))
    except ExecuteTarget as e:
        e.execve()
    except RestartBuck:
        os.execvp(os.path.join(os.path.dirname(THIS_DIR), 'bin', 'buck'), sys.argv)
    except (BuckToolException, NailgunException, NoBuckConfigFoundException) as e:
        logging.error(str(e))
        sys.exit(1)
    except KeyboardInterrupt:
        # Most shells set exit code to 128 + <Signal Number>
        # So, when catching SIGINT (2), we return 130
        sys.exit(130)