Ejemplo n.º 1
0
 def _fix_broken_entry(self, line, regex):
     if line.startswith(';'):
         return line
     m = regex.match(line)
     if not m:
         return line
     return m.groups()[0]
Ejemplo n.º 2
0
def check_tool_version(tool_name, needed, env):
    found = False
    newer = False
    if env is None:
        env = os.environ.copy()
    tool = which(tool_name, env['PATH'])
    if not tool:
        return None, False, False
    try:
        out = check_output([tool, '--version'], env=env)
    except FatalError:
        return None, False, False
    m = re.search('([0-9]+\.[0-9]+(\.[0-9]+)?)', out)
    if m:
        found = m.groups()[0]
        newer = StrictVersion(found) >= StrictVersion(needed)

    return tool, found, newer
Ejemplo n.º 3
0
    def _search_files(self, files):
        '''
        Search plugin files and arbitrary files in the prefix, doing the
        extension replacements, globbing, and listing directories

        FIXME: Curently plugins are also searched using this, but there should
        be a separate system for those.
        '''
        # replace extensions
        files_expanded = [f % self.extensions for f in files]
        fs = []
        for f in files_expanded:
            if f.endswith('.dll') and self.using_msvc():
                fs.append(self._get_msvc_dll(f))
            else:
                fs.append(f)
            # Look for a PDB file and add it
            if self.using_msvc() and self.config.variants.debug:
                # We try to find a pdb file corresponding to the plugin's .a
                # file instead of the .dll because we want it to go into the
                # devel package, not the runtime package.
                m = self._FILES_STATIC_PLUGIN_REGEX.match(f)
                if m:
                    fs += self._search_pdb_files(f, ''.join(m.groups()))
            # For plugins, the .la file is generated using the .pc file, but we
            # don't add the .pc to files_devel. It has the same name, so we can
            # add it using the .la entry.
            if f.startswith('lib/gstreamer-1.0/') and f.endswith('.la'):
                fs.append(self._get_plugin_pc(f))
        # fill directories
        dirs = [
            x for x in fs if os.path.isdir(os.path.join(self.config.prefix, x))
        ]
        for directory in dirs:
            fs.remove(directory)
            fs.extend(self._ls_dir(os.path.join(self.config.prefix,
                                                directory)))
        # fill paths with pattern expansion *
        paths = [x for x in fs if '*' in x]
        if len(paths) != 0:
            for path in paths:
                fs.remove(path)
            fs.extend(shell.ls_files(paths, self.config.prefix))
        return fs