buildframework/helium/tools/common/docs.ant.xml
changeset 179 d8ac696cc51f
parent 1 be27ed110b50
child 217 0f5e3a7fb6af
equal deleted inserted replaced
1:be27ed110b50 179:d8ac696cc51f
   108         <mkdir dir="${helium.build.dir}/doc/api/python"/>
   108         <mkdir dir="${helium.build.dir}/doc/api/python"/>
   109         <pathconvert pathsep=" " property="epydoc.python.modules.path">
   109         <pathconvert pathsep=" " property="epydoc.python.modules.path">
   110             <fileset refid="python.library.files"/>
   110             <fileset refid="python.library.files"/>
   111         </pathconvert>
   111         </pathconvert>
   112         <echo>Python modules path: ${epydoc.python.modules.path}</echo>
   112         <echo>Python modules path: ${epydoc.python.modules.path}</echo>
   113         <exec osfamily="windows" executable="python" dir="${helium.build.dir}" failonerror="true">        
   113         <exec executable="python" dir="${helium.build.dir}" failonerror="true">        
   114             <arg line="${python.tools}\epydoc"/>
   114             <arg line="${python.tools}/epydoc"/>
   115             <arg value="-v"/>
   115             <arg value="-v"/>
   116             <arg value="--config=${helium.dir}\config\epydoc.conf"/>
   116             <arg value="--config=${helium.dir}/config/epydoc.conf"/>
   117             <arg value="--exclude=sgmllib"/>
   117             <arg value="--exclude=sgmllib"/>
   118             <arg line="${epydoc.python.modules.path}"/>
   118             <arg line="${epydoc.python.modules.path}"/>
   119         </exec>
   119         </exec>
   120     </target>
   120     </target>
   121     
   121     
   256     <macrodef name="rstMacro" uri="http://www.nokia.com/helium">
   256     <macrodef name="rstMacro" uri="http://www.nokia.com/helium">
   257         <attribute name="version" default="${helium.version}"/>
   257         <attribute name="version" default="${helium.version}"/>
   258         <attribute name="src" default="${helium.build.dir}/temp/doc"/>
   258         <attribute name="src" default="${helium.build.dir}/temp/doc"/>
   259         <attribute name="output" default="${helium.build.dir}/doc"/>
   259         <attribute name="output" default="${helium.build.dir}/doc"/>
   260         <sequential>
   260         <sequential>
   261             <property name="sphinx.lib.dir" location="${helium.dir}/external/python/lib/2.5/Sphinx-0.5.1-py2.5.egg/sphinx" />
   261             <property name="sphinx.lib.dir" location="${helium.dir}/external/python/lib/common/Sphinx-0.5.1-py2.5.egg/sphinx" />
   262             <if>
   262             <if>
   263                 <available file="${nokia.python.tools}/sphinxfixsearch.diff"/>
   263                 <available file="${nokia.python.tools}/sphinxfixsearch.diff"/>
   264                 <then>
   264                 <then>
   265                     <patch patchfile="${nokia.python.tools}/sphinxfixsearch.diff" originalfile="${sphinx.lib.dir}/search.py"/>
   265                     <patch patchfile="${nokia.python.tools}/sphinxfixsearch.diff" originalfile="${sphinx.lib.dir}/search.py"/>
   266                 </then>
   266                 </then>
   267             </if>
   267             </if>
   268             <exec executable="python" failonerror="${failonerror}">        
   268             <exec executable="python" failonerror="${failonerror}">        
   269                 <arg file="${python.dir}/sphinx-build.py"/>
   269                 <arg file="${python.dir}/common/sphinx-build.py"/>
   270                 <arg value="-b" />
   270                 <arg value="-b" />
   271                 <arg value="html" />            
   271                 <arg value="html" />            
   272                 <arg value="-D" />
   272                 <arg value="-D" />
   273                 <arg value="version=@{version}" />
   273                 <arg value="version=@{version}" />
   274                 <arg value="-D" />
   274                 <arg value="-D" />
   643 import os
   643 import os
   644 import string
   644 import string
   645 import amara
   645 import amara
   646 import codecs
   646 import codecs
   647 import ant
   647 import ant
       
   648 import docs
   648 
   649 
   649 setpath = r'${helium.dir}'+'/tools'
   650 setpath = r'${helium.dir}'+'/tools'
   650 
   651 
   651 print "Searching under "+setpath
   652 print "Searching under "+setpath
   652 
   653 
   653 dbPath = r'${database.file}'
   654 dbPath = r'${database.file}'
   654 dbPath = 'file:///'+ dbPath.replace('\\','/')
   655 dbPath = 'file:///'+ dbPath.replace('\\','/')
   655 dbPrj = amara.parse(dbPath)
   656 dbPrj = amara.parse(dbPath)
   656 
   657 
   657 for root, dirs, files in os.walk(setpath, topdown=False):
   658 docs.find_python_dependencies(setpath, dbPath, dbPrj)
   658     for fname in files:
       
   659         filePattern = re.compile('.ant.xml$')
       
   660         fileMatch = filePattern.search(fname)
       
   661         modulelist = []
       
   662         if (fileMatch):
       
   663             filePath = os.path.abspath(os.path.join(root, fname))
       
   664             with open(filePath) as f:
       
   665                 filePathAmara = 'file:///'+ filePath.replace('\\','/')
       
   666                 curPrj=amara.parse(filePathAmara)
       
   667                 for line in f:
       
   668                     linePattern = re.compile('^import')
       
   669                     lineMatch = linePattern.search(line)
       
   670                     if ((lineMatch) and (line.find('.')==-1)):
       
   671                         newLine = line.replace('import','')
       
   672                         newLine = newLine.replace(',','')
       
   673                         moduleArray = newLine.split()
       
   674                         for curModule in moduleArray:
       
   675                             try:
       
   676                                 importModule = __import__(curModule)
       
   677                                 modulePath=importModule.__file__
       
   678                                 if (modulePath.find('\\helium\\tools')!= -1):
       
   679                                     for projectList in dbPrj.antDatabase.project:
       
   680                                         if (projectList.name==curPrj.project.name):
       
   681                                             if not (curModule in modulelist):
       
   682                                                 print " Python module : " +curModule
       
   683                                                 moduleElement = projectList.pythonDependency.xml_create_element(u'module', content=u''+curModule)
       
   684                                                 projectList.pythonDependency.xml_append(moduleElement)
       
   685                                             modulelist = modulelist + [curModule]
       
   686                             except Exception, e:
       
   687                                 error ="yes"
       
   688 
       
   689 
   659 
   690 file_object = codecs.open(r'${database.file}', 'w', "utf_8")
   660 file_object = codecs.open(r'${database.file}', 'w', "utf_8")
   691 file_object.write(dbPrj.xml(indent=u"yes"))
   661 file_object.write(dbPrj.xml(indent=u"yes"))
   692 file_object.close()
   662 file_object.close()
   693     
       
   694         </hlm:python>
   663         </hlm:python>
   695     </target>
   664     </target>
   696     
   665     
   697     
   666     
   698     <!-- Reads the Java libraries and extracts a list of their versions. -->
   667     <!-- Reads the Java libraries and extracts a list of their versions. -->
   839             <arg line="-Tpng -Grankdir=LR -Nshape=box -Nfontsize=9 -Nwidth=0.3 -Nheight=0.2 ${dependency.external.grph} -O"/>
   808             <arg line="-Tpng -Grankdir=LR -Nshape=box -Nfontsize=9 -Nwidth=0.3 -Nheight=0.2 ${dependency.external.grph} -O"/>
   840         </exec>
   809         </exec>
   841         
   810         
   842     </target>
   811     </target>
   843     
   812     
   844     <!-- Download data listening logs and extract data -->
       
   845     <target name="parse-datalistening">
       
   846         <exec executable="python" dir="${helium.dir}/tools/common/python/lib" failonerror="${failonerror}">
       
   847             <arg value="parsedatalistening.py"/>
       
   848         </exec>
       
   849     </target>
       
   850 
   813 
   851     <!-- Creates user flow diagram -->
   814     <!-- Creates user flow diagram -->
   852     <target name="helium-user-graph">
   815     <target name="helium-user-graph">
   853         <mkdir dir="${helium.build.dir}/doc/api"/>
   816         <mkdir dir="${helium.build.dir}/doc/api"/>
   854         <fmpp sourcefile="${helium.doc.dir}/src/user-graph.dot.ftl" outputfile="${helium.build.dir}/temp/doc/user-graph.dot">
   817         <fmpp sourcefile="${helium.doc.dir}/src/user-graph.dot.ftl" outputfile="${helium.build.dir}/temp/doc/user-graph.dot">