Exemplo n.º 1
0
 def ChangedFiles(self, request, context):
     result = fms.PathList()
     chnged_files = []
     for item in request.items:
         mtime = 0
         if os.path.exists(item.path):
             mtime = os.path.getmtime(item.path)
         if mtime != item.mtime:
             chnged_files.append(fms.PathObj(path=item.path, mtime=mtime))
     result.items.extend(chnged_files)
     return result
Exemplo n.º 2
0
    def changed_files(self, files):
        '''
        Request to test files for last modification time.

        :param files: dictionary with files and their last known modification time.
            See results of :meth:`fkie_node_manager_daemon.launch_stub.LaunchStub.get_mtimes`,
            :meth:`fkie_node_manager_daemon.launch_stub.LaunchStub.load_launch`.
        :type files: dict(str: float)
        '''
        request = fmsg.PathList()
        pathlist = []
        for path, mtime in files.items():
            pathlist.append(fmsg.PathObj(path=path, mtime=mtime))
        request.items.extend(pathlist)
        response = self.fm_stub.ChangedFiles(request,
                                             timeout=settings.GRPC_TIMEOUT)
        return response.items
Exemplo n.º 3
0
 def GetPackageBinaries(self, request, context):
     result = fms.PathList()
     binaries = []
     try:
         path = get_pkg_path(request.name)
         self._get_binaries(path, binaries)
         result.items.extend(binaries)
         # find binaries in catkin workspace
         from catkin.find_in_workspaces import find_in_workspaces as catkin_find
         search_paths = catkin_find(search_dirs=['libexec', 'share'],
                                    project=request.name,
                                    first_matching_workspace_only=True)
         for p in search_paths:
             self._get_binaries(p, binaries)
     except Exception:
         import traceback
         print(traceback.format_exc())
         pass
     return result