buildframework/helium/sf/python/pythoncore/lib/docs.py
changeset 628 7c4a911dc066
parent 587 85df38eb4012
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
    33             modulelist = []
    33             modulelist = []
    34             if (fileMatch):
    34             if (fileMatch):
    35                 filePath = os.path.abspath(os.path.join(root, fname))
    35                 filePath = os.path.abspath(os.path.join(root, fname))
    36                 with open(filePath) as f_file:
    36                 with open(filePath) as f_file:
    37                     filePathAmara = 'file:///'+ filePath.replace('\\','/')
    37                     filePathAmara = 'file:///'+ filePath.replace('\\','/')
    38                     curPrj=amara.parse(filePathAmara)
    38                     curPrj = amara.parse(filePathAmara)
    39                     for line in f_file:
    39                     for line in f_file:
    40                         linePattern = re.compile('^import')
    40                         linePattern = re.compile('^import')
    41                         lineMatch = linePattern.search(line)
    41                         lineMatch = linePattern.search(line)
    42                         if ((lineMatch) and (line.find('.')==-1)):
    42                         if ((lineMatch) and (line.find('.')==-1)):
    43                             newLine = line.replace('import','')
    43                             newLine = line.replace('import','')
    45                             moduleArray = newLine.split()
    45                             moduleArray = newLine.split()
    46                             for curModule in moduleArray:
    46                             for curModule in moduleArray:
    47                                 try:
    47                                 try:
    48                                     importModule = __import__(curModule)
    48                                     importModule = __import__(curModule)
    49                                     if hasattr(importModule, '__file__'):
    49                                     if hasattr(importModule, '__file__'):
    50                                         modulePath=importModule.__file__
    50                                         modulePath = importModule.__file__
    51                                         if 'helium' in modulePath:
    51                                         if 'helium' in modulePath:
    52                                             for projectList in dbPrj.antDatabase.project:
    52                                             for projectList in dbPrj.antDatabase.project:
    53                                                 if (projectList.name == curPrj.project.name):
    53                                                 if (projectList.name == curPrj.project.name):
    54                                                     if not (curModule in modulelist):
    54                                                     if not (curModule in modulelist):
    55                                                         print " Python module : " + curModule
    55                                                         print " Python module : " + curModule