Exemplo n.º 1
0
    def process(self, target, matches, binding):

        angle = regex.transform(matches, "<(.*)>")
        quoted = regex.transform(matches, '"(.*)"')

        g = str(id(self))
        b = os.path.normpath(os.path.dirname(binding[0]))

        # Attach binding of including file to included targets.
        # When target is directly created from virtual target
        # this extra information is unnecessary. But in other
        # cases, it allows to distinguish between two headers of the
        # same name included from different places.
        # We don't need this extra information for angle includes,
        # since they should not depend on including file (we can't
        # get literal "." in include path).
        g2 = g + "#" + b

        g = "<" + g + ">"
        g2 = "<" + g2 + ">"
        angle = [g + x for x in angle]
        quoted = [g2 + x for x in quoted]

        all = angle + quoted
        bjam.call("mark-included", target, all)

        engine = get_manager().engine()
        engine.set_target_variable(angle, "SEARCH", get_value(self.includes_))
        engine.set_target_variable(quoted, "SEARCH",
                                   [b] + get_value(self.includes_))

        # Just propagate current scanner to includes, in a hope
        # that includes do not change scanners.
        get_manager().scanners().propagate(self, angle + quoted)
Exemplo n.º 2
0
    def process (self, target, matches, binding):
       
        angle = regex.transform (matches, "<(.*)>")
        quoted = regex.transform (matches, '"(.*)"')

        g = str(id(self))
        b = os.path.normpath(os.path.dirname(binding[0]))
        
        # Attach binding of including file to included targets.
        # When target is directly created from virtual target
        # this extra information is unnecessary. But in other
        # cases, it allows to distinguish between two headers of the 
        # same name included from different places.      
        # We don't need this extra information for angle includes,
        # since they should not depend on including file (we can't
        # get literal "." in include path).
        g2 = g + "#" + b

        g = "<" + g + ">"
        g2 = "<" + g2 + ">"
        angle = [g + x for x in angle]
        quoted = [g2 + x for x in quoted]

        all = angle + quoted
        bjam.call("mark-included", target, all)

        engine = get_manager().engine()
        engine.set_target_variable(angle, "SEARCH", get_value(self.includes_))
        engine.set_target_variable(quoted, "SEARCH", [b] + get_value(self.includes_))
        
        # Just propagate current scanner to includes, in a hope
        # that includes do not change scanners. 
        get_manager().scanners().propagate(self, angle + quoted)
Exemplo n.º 3
0
def libraries_to_install(existing_libraries):
    # Decides which libraries are to be installed by looking at --with-<library>
    # --without-<library> arguments. Returns the list of directories under "libs"
    # which must be built and installed.

    with_parameter = regex.transform(sys.argv, "--with-(.*)")
    without_parameter = regex.transform(sys.argv, "--without-(.*)")

    if not with_parameter and not without_parameter:
        # Nothing is specified on command line. See if maybe
        # project-config.jam has some choices.
        project_config_libs = bjam.call("peek", "project-config", "libraries")
        with_parameter = regex.transform(project_config_libs, "--with-(.*)")
        without_parameter = regex.transform(project_config_libs, "--without-(.*)")

    # Do some checks.
    if with_parameter and without_parameter:
        get_manager().errors()("both --with-<library> and --without-<library> specified")

    wrong = set.difference(with_parameter, existing_libraries)
    if wrong:
        get_manager().errors()("wrong library name '" + wrong[0] + "' in the --with-<library> option.")

    wrong = set.difference(without_parameter, existing_libraries)
    if wrong:
        get_manager().errors()("wrong library name '" + wrong[0] + "' in the --without-<library> option.")

    if with_parameter:
        return set.intersection(existing_libraries, with_parameter)
    else:
        return set.difference(existing_libraries, without_parameter)
Exemplo n.º 4
0
def libraries_to_install(existing_libraries):
    # Decides which libraries are to be installed by looking at --with-<library>
    # --without-<library> arguments. Returns the list of directories under "libs"
    # which must be built and installed.

    with_parameter = regex.transform(sys.argv, "--with-(.*)")
    without_parameter = regex.transform(sys.argv, "--without-(.*)")

    if not with_parameter and not without_parameter:
        # Nothing is specified on command line. See if maybe
        # project-config.jam has some choices.
        project_config_libs = bjam.call("peek", "project-config", "libraries")
        with_parameter = regex.transform(project_config_libs, "--with-(.*)")
        without_parameter = regex.transform(project_config_libs,
                                            "--without-(.*)")

    # Do some checks.
    if with_parameter and without_parameter:
        get_manager().errors()(
            "both --with-<library> and --without-<library> specified")

    wrong = set.difference(with_parameter, existing_libraries)
    if wrong:
        get_manager().errors()("wrong library name '" + wrong[0] +
                               "' in the --with-<library> option.")

    wrong = set.difference(without_parameter, existing_libraries)
    if wrong:
        get_manager().errors()("wrong library name '" + wrong[0] +
                               "' in the --without-<library> option.")

    if with_parameter:
        return set.intersection(existing_libraries, with_parameter)
    else:
        return set.difference(existing_libraries, without_parameter)
Exemplo n.º 5
0
Arquivo: rc.py Projeto: gleyba/yazik
    def process(self, target, matches, binding):
        binding = binding[0]
        angle = regex.transform(matches, "#include[ ]*<([^<]+)>")
        quoted = regex.transform(matches, "#include[ ]*\"([^\"]+)\"")
        res = regex.transform(matches,
                              "[^ ]+[ ]+(BITMAP|CURSOR|FONT|ICON|MESSAGETABLE|RT_MANIFEST)" +\
                              "[ ]+(([^ \"]+)|\"([^\"]+)\")", [3, 4])

        # Icons and other includes may referenced as
        #
        # IDR_MAINFRAME ICON "res\\icon.ico"
        #
        # so we have to replace double backslashes to single ones.
        res = [
            re.sub(r'\\\\', '/', match) for match in res if match is not None
        ]

        # CONSIDER: the new scoping rule seem to defeat "on target" variables.
        g = bjam.call('get-target-variable', target, 'HDRGRIST')[0]
        b = os.path.normpath(os.path.dirname(binding))

        # Attach binding of including file to included targets.
        # When target is directly created from virtual target
        # this extra information is unnecessary. But in other
        # cases, it allows to distinguish between two headers of the
        # same name included from different places.
        # We don't need this extra information for angle includes,
        # since they should not depend on including file (we can't
        # get literal "." in include path).
        g2 = g + "#" + b

        g = "<" + g + ">"
        g2 = "<" + g2 + ">"
        angle = [g + x for x in angle]
        quoted = [g2 + x for x in quoted]
        res = [g2 + x for x in res]

        all = angle + quoted

        bjam.call('mark-included', target, all)

        engine = get_manager().engine()

        engine.add_dependency(target, res)
        bjam.call('NOCARE', all + res)
        engine.set_target_variable(
            angle, 'SEARCH', [utility.get_value(inc) for inc in self.includes])
        engine.set_target_variable(
            quoted, 'SEARCH',
            [b + utility.get_value(inc) for inc in self.includes])
        engine.set_target_variable(
            res, 'SEARCH',
            [b + utility.get_value(inc) for inc in self.includes])

        # Just propagate current scanner to includes, in a hope
        # that includes do not change scanners.
        get_manager().scanners().propagate(self, angle + quoted)
Exemplo n.º 6
0
    def process(self, target, matches, binding):
        binding = binding[0]
        angle = regex.transform(matches, "#include[ ]*<([^<]+)>")
        quoted = regex.transform(matches, "#include[ ]*\"([^\"]+)\"")
        res = regex.transform(matches,
                              "[^ ]+[ ]+(BITMAP|CURSOR|FONT|ICON|MESSAGETABLE|RT_MANIFEST)" +\
                              "[ ]+(([^ \"]+)|\"([^\"]+)\")", [3, 4])

        # Icons and other includes may referenced as
        #
        # IDR_MAINFRAME ICON "res\\icon.ico"
        #
        # so we have to replace double backslashes to single ones.
        res = [ re.sub(r'\\\\', '/', match) for match in res if match is not None ]

        # CONSIDER: the new scoping rule seem to defeat "on target" variables.
        g = bjam.call('get-target-variable', target, 'HDRGRIST')[0]
        b = os.path.normpath(os.path.dirname(binding))

        # Attach binding of including file to included targets.
        # When target is directly created from virtual target
        # this extra information is unnecessary. But in other
        # cases, it allows to distinguish between two headers of the
        # same name included from different places.
        # We don't need this extra information for angle includes,
        # since they should not depend on including file (we can't
        # get literal "." in include path).
        g2 = g + "#" + b

        g = "<" + g + ">"
        g2 = "<" + g2 + ">"
        angle = [g + x for x in angle]
        quoted = [g2 + x for x in quoted]
        res = [g2 + x for x in res]

        all = angle + quoted

        bjam.call('mark-included', target, all)

        engine = get_manager().engine()

        engine.add_dependency(target, res)
        bjam.call('NOCARE', all + res)
        engine.set_target_variable(angle, 'SEARCH', [utility.get_value(inc) for inc in self.includes])
        engine.set_target_variable(quoted, 'SEARCH', [b + utility.get_value(inc) for inc in self.includes])
        engine.set_target_variable(res, 'SEARCH', [b + utility.get_value(inc) for inc in self.includes])

        # Just propagate current scanner to includes, in a hope
        # that includes do not change scanners.
        get_manager().scanners().propagate(self, angle + quoted)
Exemplo n.º 7
0
    def process(self, target, matches, binding):
        included_angle = regex.transform(matches, self.re_include_angle)
        included_quoted = regex.transform(matches, self.re_include_quoted)
        imported = regex.transform(matches, self.re_import, [1, 3])
        imported_tlbs = regex.transform(matches, self.re_importlib, [1, 3])

        # CONSIDER: the new scoping rule seem to defeat "on target" variables.
        g = bjam.call('get-target-variable', target, 'HDRGRIST')[0]
        b = os.path.normpath(os.path.dirname(binding))

        # Attach binding of including file to included targets.
        # When target is directly created from virtual target
        # this extra information is unnecessary. But in other
        # cases, it allows to distinguish between two headers of the
        # same name included from different places.
        g2 = g + "#" + b

        g = "<" + g + ">"
        g2 = "<" + g2 + ">"

        included_angle = [g + x for x in included_angle]
        included_quoted = [g + x for x in included_quoted]
        imported = [g + x for x in imported]
        imported_tlbs = [g + x for x in imported_tlbs]

        all = included_angle + included_quoted + imported

        bjam.call('INCLUDES', [target], all)
        bjam.call('DEPENDS', [target], imported_tlbs)
        bjam.call('NOCARE', all + imported_tlbs)
        engine.set_target_variable(
            included_angle, 'SEARCH',
            [utility.get_value(inc) for inc in self.includes])
        engine.set_target_variable(
            included_quoted, 'SEARCH',
            [utility.get_value(inc) for inc in self.includes])
        engine.set_target_variable(
            imported, 'SEARCH',
            [utility.get_value(inc) for inc in self.includes])
        engine.set_target_variable(
            imported_tlbs, 'SEARCH',
            [utility.get_value(inc) for inc in self.includes])

        get_manager().scanners().propagate(
            type.get_scanner('CPP', PropertySet(self.includes)),
            included_angle + included_quoted)
        get_manager().scanners().propagate(self, imported)
Exemplo n.º 8
0
    def process(self, target, matches, binding):
        included_angle = regex.transform(matches, self.re_include_angle)
        included_quoted = regex.transform(matches, self.re_include_quoted)
        imported = regex.transform(matches, self.re_import, [1, 3])
        imported_tlbs = regex.transform(matches, self.re_importlib, [1, 3])

        # CONSIDER: the new scoping rule seem to defeat "on target" variables.
        g = bjam.call("get-target-variable", target, "HDRGRIST")[0]
        b = os.path.normpath(os.path.dirname(binding))

        # Attach binding of including file to included targets.
        # When target is directly created from virtual target
        # this extra information is unnecessary. But in other
        # cases, it allows to distinguish between two headers of the
        # same name included from different places.
        g2 = g + "#" + b

        g = "<" + g + ">"
        g2 = "<" + g2 + ">"

        included_angle = [g + x for x in included_angle]
        included_quoted = [g + x for x in included_quoted]
        imported = [g + x for x in imported]
        imported_tlbs = [g + x for x in imported_tlbs]

        all = included_angle + included_quoted + imported

        bjam.call("INCLUDES", [target], all)
        bjam.call("DEPENDS", [target], imported_tlbs)
        bjam.call("NOCARE", all + imported_tlbs)
        engine.set_target_variable(included_angle, "SEARCH", [utility.get_value(inc) for inc in self.includes])
        engine.set_target_variable(included_quoted, "SEARCH", [utility.get_value(inc) for inc in self.includes])
        engine.set_target_variable(imported, "SEARCH", [utility.get_value(inc) for inc in self.includes])
        engine.set_target_variable(imported_tlbs, "SEARCH", [utility.get_value(inc) for inc in self.includes])

        get_manager().scanners().propagate(
            type.get_scanner("CPP", PropertySet(self.includes)), included_angle + included_quoted
        )
        get_manager().scanners().propagate(self, imported)