Ejemplo n.º 1
0
 def _installed_directories(self):
     for path in os.environ["PATH"].split(os.pathsep):
         if not os.path.exists(path):
             continue
         for e in os.listdir(path):
             b = Path(os.path.join(path, e))
             if b.is_file() and b.filename() in CLANG_BINARIES:
                 yield b.directory()
Ejemplo n.º 2
0
 def _find_binaries(self, search_directories):
     binaries = {}
     for directory in search_directories:
         for binary in CLANG_BINARIES:
             path = Path(os.path.join(directory, binary))
             if not path.exists():
                 continue
             path.assert_is_file()
             path.assert_mode(os.R_OK | os.X_OK)
             if path.filename() not in binaries:
                 binaries[path.filename()] = []
             version = str(ClangVersion(str(path)))
             binaries[path.filename()].append({
                 'path': str(path),
                 'version': version
             })
     return binaries
Ejemplo n.º 3
0
 def __init__(self, binary_path):
     p = Path(binary_path)
     if p.filename() in ASK_FOR_VERSION:
         self.version = self._version_from_asking(binary_path)
     else:
         self.version = self._version_from_path(binary_path)