Example #1
0
def _SetUp(include_server_port):
    """Setup include_analyzer and socket server.

  Returns: (include_analyzer, server)"""

    try:
        os.unlink(include_server_port)
    except (IOError, OSError):
        pass  # this would be expected, the port provided should not exist

    if os.sep != '/':
        sys.exit("Expected '/' as separator in filepaths.")

    client_root_keeper = basics.ClientRootKeeper()
    # Clean out any junk left over from prior runs.
    client_root_keeper.CleanOutOthers()

    Debug(DEBUG_TRACE, "Starting socketserver %s" % include_server_port)

    # Create the analyser.
    include_analyzer = (
        include_analyzer_memoizing_node.IncludeAnalyzerMemoizingNode(
            client_root_keeper, basics.opt_stat_reset_triggers))
    include_analyzer.email_sender = _EmailSender()

    # Wrap it inside a handler that is a part of a UnixStreamServer.
    server = Queuingsocketserver(
        include_server_port,
        # Now, produce a StreamRequestHandler subclass whose new objects has
        # a handler which calls the include_analyzer just made.
        DistccIncludeHandlerGenerator(include_analyzer))

    return (include_analyzer, server)
    def setUp(self):
        basics.opt_debug_pattern = 1
        client_root_keeper = basics.ClientRootKeeper()
        self.include_analyzer = (
            include_analyzer_memoizing_node.IncludeAnalyzerMemoizingNode(
                client_root_keeper))

        self.includepath_map = self.include_analyzer.includepath_map
        self.canonical_path = self.include_analyzer.canonical_path
        self.directory_map = self.include_analyzer.directory_map
        self.realpath_map = self.include_analyzer.realpath_map
    def setUp(self):

        statistics.StartTiming()
        self.global_dirs = []
        basics.opt_print_statistics = False
        basics.opt_debug_pattern = 1
        client_root_keeper = basics.ClientRootKeeper()
        if algorithm == basics.MEMOIZING:
            self.include_analyzer = (
                include_analyzer_memoizing_node.IncludeAnalyzerMemoizingNode(
                    client_root_keeper))
        else:
            self.fail("Algorithm not known.")

        statistics.StartTiming()

        self.directory_map = self.include_analyzer.directory_map
        self.compiler_defaults = self.include_analyzer.compiler_defaults
        self.canonical_path = self.include_analyzer.canonical_path