예제 #1
0
    def getImageInfos(self, rootDir):
        result = {}

        for img in filetool.find(rootDir, imgpatt):
            self._console.debug("Analysing image: %s" % img)
            #mo = self.imgpatt.search(img)
            imgInfo = ImgInfo(img).getImageInfo()
            if imgInfo:
                result[img] = {'width': imgInfo[0], 'height': imgInfo[1], 'type': imgInfo[2]}

        return result
def main():
    apidata = {}
    apidata['type'] = 'doctree'
    apidata['children'] = []
    apidata['attributes'] = {}
    apidata['children'].append({
        "type": "packages",
        "attributes": {},
        "children": []
    })
    filetool.directory(store_path)

    dirwalker = filetool.find(module_root, r'\.py$')

    for pyfile in dirwalker:
        #if os.stat(pyfile).st_size == 0:
        #    continue
        # get the file's api doc as json
        filejson = pyapi2json(pyfile)
        apipackage = file2package(pyfile, module_root)
        # and store it
        filetool.save(store_path + '/' + apipackage + '.json', filejson)
        # make an entry in apidata struct
        levels = apipackage.split('.')
        curr = apidata['children'][0]['children']
        for pos, level in enumerate(levels):
            if level not in (x['attributes']['name'] for x in curr
                             if 'name' in x['attributes']):
                newentry = {
                    "children": [],
                    "type": "packages" if pos % 2 else "package",
                    "attributes": {
                        "packageName": ".".join(levels[:pos]),
                        "name": level,
                        "fullName": ".".join(levels[:pos + 1])
                    }
                }
                if pos == len(levels) - 1:
                    newentry["externalRef"] = True
                    #del newentry['children']
                    #newentry["type"] = "classes"
                    pass
                curr.append(newentry)
                curr = newentry['children']
            else:
                curr = [
                    x['children'] for x in curr
                    if x['attributes']['name'] == level
                ][0]

    # store apidata
    filetool.save(store_path + '/' + "apidata.json", json.dumps(apidata))
예제 #3
0
    def getImageInfos(self, rootDir):
        result = {}

        for img in filetool.find(rootDir, imgpatt):
            self._console.debug("Analysing image: %s" % img)
            #mo = self.imgpatt.search(img)
            imgInfo = ImgInfo(img).getImageInfo()
            if imgInfo:
                result[img] = {
                    'width': imgInfo[0],
                    'height': imgInfo[1],
                    'type': imgInfo[2]
                }

        return result
예제 #4
0
def main():
    apidata = {}
    apidata['type'] = 'doctree'
    apidata['children'] = []
    apidata['attributes'] = {}
    apidata['children'].append({
      "type":"packages","attributes":{},"children":[]  
    })
    filetool.directory(store_path)

    dirwalker = filetool.find(module_root, r'\.py$')

    for pyfile in dirwalker:
        #if os.stat(pyfile).st_size == 0:
        #    continue
        # get the file's api doc as json
        filejson = pyapi2json(pyfile)
        apipackage = file2package(pyfile, module_root)
        # and store it
        filetool.save(store_path+'/'+apipackage+'.json', filejson)
        # make an entry in apidata struct
        levels = apipackage.split('.')
        curr = apidata['children'][0]['children']
        for pos,level in enumerate(levels):
            if level not in (x['attributes']['name'] for x in curr if 'name' in x['attributes']):
                newentry = {
                    "children" : [],
                    "type" : "packages" if pos % 2 else "package",
                    "attributes" : {
                        "packageName" : ".".join(levels[:pos]),
                        "name" : level,
                        "fullName" : ".".join(levels[:pos+1])
                    }
                }
                if pos==len(levels)-1:
                    newentry["externalRef"] = True
                    #del newentry['children']
                    #newentry["type"] = "classes"
                    pass
                curr.append(newentry)
                curr = newentry['children']
            else:
                curr = [x['children'] for x in curr if x['attributes']['name']==level][0]
        

    # store apidata
    filetool.save(store_path+'/'+"apidata.json", json.dumps(apidata))
예제 #5
0
 def scanResourcePath(self):
     # path to the lib resource root
     libpath = os.path.normpath(self.resourcePath)  # normalize "./..."
     liblist = filetool.find(libpath)  # liblist is a generator
     return liblist
예제 #6
0
 def scanResourcePath(self):
     # path to the lib resource root
     libpath = os.path.normpath(self.resourcePath)  # normalize "./..."
     liblist = filetool.find(libpath)  # liblist is a generator
     return liblist