示例#1
0
文件: setup.py 项目: yeonbok/openvino
def find_prebuilt_extensions(search_dirs):
    """collect prebuilt python extensions"""
    extensions = []
    ext_pattern = ''
    if sys.platform == 'linux':
        ext_pattern = '**/*.so'
    elif sys.platform == 'win32':
        ext_pattern = '**/*.pyd'
    elif sys.platform == 'darwin':
        ext_pattern = '**/*.so'
    for base_dir in search_dirs:
        for path in Path(base_dir).glob(ext_pattern):
            if path.match('openvino/libs/*'):
                continue
            relpath = path.relative_to(base_dir)
            if relpath.parent != '.':
                package_names = str(relpath.parent).split(os.path.sep)
            else:
                package_names = []
            package_names.append(path.name.split('.', 1)[0])
            name = '.'.join(package_names)
            extensions.append(PrebuiltExtension(name, sources=[str(path)]))
    if not extensions:
        extensions.append(
            PrebuiltExtension('openvino', sources=[str('setup.py')]))
    return extensions
示例#2
0
def genFileTree(widget, pathobj, expandAbovePathName=None, onlyIncludeDirsWithPyFiles=False):
    """
    Construct the file tree
    :param widget: Initial object is root TreeWidget
    :param pathobj: Root directory that contains files that show up in the file tree
    :param expandAbovePathName: Specifies path of a new file so directories can be expanded to reveal the file
    :return:
    """
    childrange = range(widget.childCount())
    for path in pathobj.iterdir():
        if str(path) in [widget.child(p).path for p in childrange]: #check if tree item already exists
            for childind in childrange:
                if widget.child(childind).path == str(path):
                    if path.is_dir():
                        genFileTree(widget.child(childind), path, expandAbovePathName)
        else: #otherwise make a new tree item.
            if path.parts[-1].split('.')[-1] == 'py':
                child = TreeItem()
                child.setText(0, str(path.parts[-1]))
                child.path = str(path)
                child.isdir = False
                child.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsSelectable)
                child.setIcon(0,QtGui.QIcon( ":/openicon/icons/edit-shred.png"))
                widget.addChild(child)
                if not expandAbovePathName is None and path == expandAbovePathName: # expand directories containing a new file
                    expandAboveChild(widget)
            elif path.is_dir() and not path.match('*/__*__*') and (not onlyIncludeDirsWithPyFiles or len(list(path.glob('**/*.py')))):
                child = TreeItem()
                child.setText(0, str(path.parts[-1]))
                child.path = str(path)
                child.setFlags(QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsSelectable)
                child.setIcon(0,QtGui.QIcon( ":/openicon/icons/document-open-5.png"))
                widget.addChild(child)
                genFileTree(child, path, expandAbovePathName)
    widget.sortChildren(0, 0)
def getSubModules():
    if (not os.path.isfile(".gitmodules")):
        return []

    gitmfile = open(".gitmodules", "r")
    modules = []

    urlregex = "(\s)*url(\s)*=(\s)*[email protected]:(.*)/(.*)"
    pathregex = "(\s)*path(\s)*=(.*)"

    url = re.compile(urlregex)
    path = re.compile(pathregex)

    module = {}
    for line in gitmfile:
        print "Obtained: %s" % line
        if len(line) == 0:
            continue

        pmatch = path.match(line)
        umatch = url.match(line)

        if (umatch is not None and len(umatch.groups()) == 5):
            module["name"] = umatch.groups()[4].strip().replace(".git", "")

        elif (pmatch is not None and len(pmatch.groups()) == 3):
            module["path"] = pmatch.groups()[2].strip()

        if ("path" in module and "name" in module):
            modules.append(module)
            module = {}

    return modules
示例#4
0
def find_prebuilt_extensions(search_dirs):
    """Collect prebuilt python extensions."""
    extensions = []
    ext_pattern = ""
    if sys.platform == "linux":
        ext_pattern = "**/*.so"
    elif sys.platform == "win32":
        ext_pattern = "**/*.pyd"
    elif sys.platform == "darwin":
        ext_pattern = "**/*.so"
    for base_dir in search_dirs:
        for path in Path(base_dir).glob(ext_pattern):
            if path.match("openvino/libs/*"):
                continue
            relpath = path.relative_to(base_dir)
            if relpath.parent != ".":
                package_names = str(relpath.parent).split(os.path.sep)
            else:
                package_names = []
            package_names.append(path.name.split(".", 1)[0])
            name = ".".join(package_names)
            extensions.append(PrebuiltExtension(name, sources=[str(path)]))
    if not extensions:
        extensions.append(
            PrebuiltExtension("openvino", sources=[str("setup.py")]))
    return extensions
示例#5
0
 def exclusion(path):
     if path.as_posix() in non_special_excludes:
         return True
     for pattern in match_excludes:
         result = path.match(pattern, match_entire=True)
         if result:
             return True
     return False
示例#6
0
 def exclusion(path):
     if path.as_posix() in non_special_excludes:
         return True
     for pattern in match_excludes:
         result = path.match(pattern, match_entire=True)
         if result:
             return True
     return False
示例#7
0
 def newOutputs(self, toolresults):
     if toolresults is None or toolresults.bildfiles is None: return
     scale_factor = toolresults.toolinfo['scale_factor']
     self.geomView.clearDecorations()
     for path in toolresults.bildfiles:
         if path.match('*target_geometry.bild'):
             base_bild = bildparser.parseBildFile(path, scale_factor)
             base_aabb = geom.AABB(base_bild)
     for path in toolresults.bildfiles:
         if path.match('*_cylinder_model.bild'):
             self.geomView.setCylDisplay(bildparser.parseBildFile(path),
                                         base_aabb)
         elif path.match('*_atomic_model_multi.bild'):
             self.geomView.setAtomDisplay(bildparser.parseBildFile(path),
                                          base_aabb, 0)
         elif path.match('*_atomic_model_two.bild'):
             self.geomView.setAtomDisplay(bildparser.parseBildFile(path),
                                          base_aabb, 1)
         elif path.match('*_routing_multi.bild'):
             self.geomView.setRoutDisplay(bildparser.parseBildFile(path),
                                          base_aabb, 0)
         elif path.match('*_routing_two.bild'):
             self.geomView.setRoutDisplay(bildparser.parseBildFile(path),
                                          base_aabb, 1)
     self.toggleOutputControls(True)
     self.toolresults = toolresults
     # Request a redraw to avoid a bug where disabled entities might be visible at first
     self.geomView.requestUpdate()
示例#8
0
 def log(self, request):
     if hasattr(self, 'filtered_paths'):
         for path in self.filtered_paths:
             if path.match(request.uri):
                 return None
     return server.Site.log(self, request)
示例#9
0
 def __iter__(self):
     for path in self._path.iterdir():
         if not path.match('.*') and path.is_file():
             yield Image.open(str(path.absolute()))
示例#10
0
 def excluded(path):
     if any(path.match(ex) for ex in ignore):
         return True
     for part in path.parts:
         if any(Path(part).match(ex) for ex in ignore):
             return True
示例#11
0
 def glob(self, pattern: str) -> Iterator[str]:
     pattern = "/" + pattern.lstrip("/")
     for collection in self.files, self.dirs:
         for path in collection:
             if path.match(pattern):
                 yield str(path)[1:]
示例#12
0
 def __iter__(self):
     for path in self._path.iterdir():
         if not path.match('.*') and path.is_file():
             yield Image.open(str(path.absolute()))
示例#13
0
 def _IsWantedDataFile(self, paths):
     for glob in self._data_file_globs:
         for path in paths:
             if path.match(glob):
                 return True
     return False