How to use the b2.util.path.glob function in b2

To help you get started, we’ve selected a few b2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github clasp-developers / clasp / externals / boostbuild2 / src / build / project.py View on Github external
def load_jamfile(self, dir, jamfile_module):
        """Load a Jamfile at the given directory. Returns nothing.
        Will attempt to load the file as indicated by the JAMFILE patterns.
        Effect of calling this rule twice with the same 'dir' is underfined."""

        # See if the Jamfile is where it should be.
        is_jamroot = False
        jamfile_to_load = b2.util.path.glob([dir], self.JAMROOT)
        if not jamfile_to_load:
            jamfile_to_load = self.find_jamfile(dir)
        else:
            if len(jamfile_to_load) > 1:
                get_manager().errors()("Multiple Jamfiles found at '%s'\n" +\
                                       "Filenames are: %s"
                                       % (dir, [os.path.basename(j) for j in jamfile_to_load]))

            is_jamroot = True
            jamfile_to_load = jamfile_to_load[0]

        dir = os.path.dirname(jamfile_to_load)
        if not dir:
            dir = "."

        self.used_projects[jamfile_module] = []
github stan-dev / math / lib / boost_1.69.0 / tools / build / src / tools / common.py View on Github external
def find_tool(name, additional_paths = [], path_last = False):
    """ Attempts to find tool (binary) named 'name' in PATH and in
        'additional-paths'.  If found in path, returns 'name'.  If
        found in additional paths, returns full name.  If the tool
        is found in several directories, returns the first path found.
        Otherwise, returns the empty string.  If 'path_last' is specified,
        path is checked after 'additional_paths'.
    """
    assert isinstance(name, basestring)
    assert is_iterable_typed(additional_paths, basestring)
    assert isinstance(path_last, (int, bool))

    programs = path.programs_path()
    match = path.glob(programs, [name, name + '.exe'])
    additional_match = path.glob(additional_paths, [name, name + '.exe'])

    result = []
    if path_last:
        result = additional_match
        if not result and match:
            result = match

    else:
        if match:
            result = match

        elif additional_match:
            result = additional_match

    if result:
github PDAL / PDAL / boost / tools / build / v2 / tools / common.py View on Github external
def find_tool(name, additional_paths = [], path_last = False):
    """ Attempts to find tool (binary) named 'name' in PATH and in
        'additional-paths'.  If found in path, returns 'name'.  If
        found in additional paths, returns full name.  If the tool
        is found in several directories, returns the first path found.
        Otherwise, returns the empty string.  If 'path_last' is specified,
        path is checked after 'additional_paths'.
    """
    assert(isinstance(name, str))
    assert(isinstance(additional_paths, list))
    assert(isinstance(path_last, bool))

    programs = path.programs_path()
    match = path.glob(programs, [name, name + '.exe'])
    additional_match = path.glob(additional_paths, [name, name + '.exe'])

    result = []
    if path_last:
        result = additional_match
        if not result and match:
            result = match

    else:
        if match:
            result = match

        elif additional_match:
            result = additional_match

    if result:
        return path.native(result[0])
github stan-dev / math / lib / boost_1.69.0 / tools / build / src / tools / common.py View on Github external
or is a full name to an existing file.
    """
    assert isinstance(command, basestring)
    dirname = os.path.dirname(command)
    if dirname:
        if os.path.exists(command):
            return command
        # Both NT and Cygwin will run .exe files by their unqualified names.
        elif on_windows() and os.path.exists(command + '.exe'):
            return command
        # Only NT will run .bat files by their unqualified names.
        elif os_name() == 'NT' and os.path.exists(command + '.bat'):
            return command
    else:
        paths = path.programs_path()
        if path.glob(paths, [command]):
            return command
github stan-dev / math / lib / boost_1.69.0 / tools / build / src / build / project.py View on Github external
def load_jamfile(self, dir, jamfile_module):
        """Load a Jamfile at the given directory. Returns nothing.
        Will attempt to load the file as indicated by the JAMFILE patterns.
        Effect of calling this rule twice with the same 'dir' is underfined."""
        assert isinstance(dir, basestring)
        assert isinstance(jamfile_module, basestring)

        # See if the Jamfile is where it should be.
        is_jamroot = False
        jamfile_to_load = b2.util.path.glob([dir], self.JAMROOT)
        if jamfile_to_load:
            if len(jamfile_to_load) > 1:
                get_manager().errors()(
                    "Multiple Jamfiles found at '{}'\n"
                    "Filenames are: {}"
                    .format(dir, ' '.join(os.path.basename(j) for j in jamfile_to_load))
                )
            is_jamroot = True
            jamfile_to_load = jamfile_to_load[0]
        else:
            jamfile_to_load = self.find_jamfile(dir)

        dir = os.path.dirname(jamfile_to_load)
        if not dir:
            dir = "."
github SilverIce / JContainers / dep / boost / tools / build / src / build / project.py View on Github external
def load_jamfile(self, dir, jamfile_module):
        """Load a Jamfile at the given directory. Returns nothing.
        Will attempt to load the file as indicated by the JAMFILE patterns.
        Effect of calling this rule twice with the same 'dir' is underfined."""

        # See if the Jamfile is where it should be.
        is_jamroot = False
        jamfile_to_load = b2.util.path.glob([dir], self.JAMROOT)
        if not jamfile_to_load:
            jamfile_to_load = self.find_jamfile(dir)
        else:
            if len(jamfile_to_load) > 1:
                get_manager().errors()("Multiple Jamfiles found at '%s'\n" +\
                                       "Filenames are: %s"
                                       % (dir, [os.path.basename(j) for j in jamfile_to_load]))

            is_jamroot = True
            jamfile_to_load = jamfile_to_load[0]

        dir = os.path.dirname(jamfile_to_load)
        if not dir:
            dir = "."

        self.used_projects[jamfile_module] = []
github mzdb / pwiz-mzdb / libraries / boost-build / src / build / project.py View on Github external
def load_jamfile(self, dir, jamfile_module):
        """Load a Jamfile at the given directory. Returns nothing.
        Will attempt to load the file as indicated by the JAMFILE patterns.
        Effect of calling this rule twice with the same 'dir' is underfined."""
        assert isinstance(dir, basestring)
        assert isinstance(jamfile_module, basestring)

        # See if the Jamfile is where it should be.
        is_jamroot = False
        jamfile_to_load = b2.util.path.glob([dir], self.JAMROOT)
        if jamfile_to_load:
            if len(jamfile_to_load) > 1:
                get_manager().errors()(
                    "Multiple Jamfiles found at '{}'\n"
                    "Filenames are: {}"
                    .format(dir, ' '.join(os.path.basename(j) for j in jamfile_to_load))
                )
            is_jamroot = True
            jamfile_to_load = jamfile_to_load[0]
        else:
            jamfile_to_load = self.find_jamfile(dir)

        dir = os.path.dirname(jamfile_to_load)
        if not dir:
            dir = "."
github boostorg / build / src / build / project.py View on Github external
def load_jamfile(self, dir, jamfile_module):
        """Load a Jamfile at the given directory. Returns nothing.
        Will attempt to load the file as indicated by the JAMFILE patterns.
        Effect of calling this rule twice with the same 'dir' is underfined."""
        assert isinstance(dir, basestring)
        assert isinstance(jamfile_module, basestring)

        # See if the Jamfile is where it should be.
        is_jamroot = False
        jamfile_to_load = b2.util.path.glob([dir], self.JAMROOT)
        if jamfile_to_load:
            if len(jamfile_to_load) > 1:
                get_manager().errors()(
                    "Multiple Jamfiles found at '{}'\n"
                    "Filenames are: {}"
                    .format(dir, ' '.join(os.path.basename(j) for j in jamfile_to_load))
                )
            is_jamroot = True
            jamfile_to_load = jamfile_to_load[0]
        else:
            jamfile_to_load = self.find_jamfile(dir)

        dir = os.path.dirname(jamfile_to_load)
        if not dir:
            dir = "."
github PDAL / PDAL / boost / tools / build / v2 / tools / common.py View on Github external
def find_tool(name, additional_paths = [], path_last = False):
    """ Attempts to find tool (binary) named 'name' in PATH and in
        'additional-paths'.  If found in path, returns 'name'.  If
        found in additional paths, returns full name.  If the tool
        is found in several directories, returns the first path found.
        Otherwise, returns the empty string.  If 'path_last' is specified,
        path is checked after 'additional_paths'.
    """
    assert(isinstance(name, str))
    assert(isinstance(additional_paths, list))
    assert(isinstance(path_last, bool))

    programs = path.programs_path()
    match = path.glob(programs, [name, name + '.exe'])
    additional_match = path.glob(additional_paths, [name, name + '.exe'])

    result = []
    if path_last:
        result = additional_match
        if not result and match:
            result = match

    else:
        if match:
            result = match

        elif additional_match:
            result = additional_match

    if result: