PyXMake Developer Guide: D:/03_Workspaces/01_Eclipse/pyx_core/PyXMake/VTL/doxygen.py Source File

| PyXMake Developer Guide 1.0 PyXMake

D:/03_Workspaces/01_Eclipse/pyx_core/PyXMake/VTL/doxygen.py
1 # -*- coding: utf-8 -*-
2 # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 # % PyXMake - Build environment for PyXMake %
4 # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 """
6 Triple-use minimum working example for PyXMake. This script can be
7 executed in three different ways in varying levels of accessibility
8
9 @note: Create html source code documentations for PyXMake, PyCODAC,
10 MCODAC & BoxBeam with Doxygen.
11 Created on 22.03.2018
12
13 @version: 1.0
14 ----------------------------------------------------------------------------------------------
15 @requires:
16 - PyXMake, PyCODAC
17
18 @change:
19 -
20
21 @author: garb_ma [DLR-FA,STM Braunschweig]
22 ----------------------------------------------------------------------------------------------
23 """
24 import os, sys
25 import argparse
26
27 try:
28 import PyXMake as _
29 except ImportError:
30 # Script is executed as a plug-in
31 sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
32 finally:
33 from PyXMake.Tools import Utility #@UnresolvedImport
34 from PyXMake.Build import Make as pyx #@UnresolvedImport
35 from PyXMake import PyXMakePath #@UnresolvedImport
36 from PyXMake import VTL #@UnresolvedImport
37
38 try:
39 from PyCODAC import PyCODACPath
40 # Import PyCODAC to build library locally during setup.
41 from PyCODAC.Tools.Utility import GetPyCODACPath
42 # Import and set local path to PyCODAC
43 __mcd_core_path = os.path.join(GetPyCODACPath(),"Core")
44 except ImportError:
45 # This script is not executed as plug-in
46 __mcd_core_path = ""
47 except:
48 # Something else went wrong.
49 from PyXMake.Tools import ErrorHandling
50 ErrorHandling.InputError(20)
51
52 def main(
53 BuildID,
54 # Build MCODAC by default
55 title=["MCODAC", "MCODAC Developer Guide"],
56 files=VTL.GetSourceCode(0), ftype="Fortran",
57 # Resource paths
58 source=os.path.join(__mcd_core_path,"src"),
59 output=os.path.join(os.path.dirname(__mcd_core_path),"VTL","doc","mcd_core"),
60 # Scratch directory & verbosity
61 scratch=VTL.Scratch, verbosity=0,
62 # Additional keyword arguments
63 **kwargs):
64 """
65 Main function to execute the script.
66 """
67 # Default command. Use settings to modify the documentation.
68 doxcommand = os.path.join(pyx.Path2Config,"stm_doc_config")
69
70 DoxyBuild = pyx.Doxygen(BuildID, files, stype=ftype, msvsc="vs2015", scratch=scratch, verbose=verbosity)
71 if ftype not in ("Python", "Java"):
72 DoxyBuild.SourcePath(source)
73 DoxyBuild.OutputPath(output)
74 if ftype not in ("Python", "Java"):
75 DoxyBuild.Preprocessing("fpp -P -e", inend=".for", outend=".fpp")
76 DoxyBuild.Build(doxcommand)
77 DoxyBuild.Settings(brief=title[0], header=title[1])
78 DoxyBuild.create()
79
80 if __name__ == "__main__":
81 # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82 # % Access command line inputs %
83 # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
84 parser = argparse.ArgumentParser(description="Build shared Fortran libraries for Python remotely on the institute cluster.")
85
86 try:
87 _ = sys.argv[1]
88 args, _ = parser.parse_known_args()
89 # Extract command line option to identify the requested make operation
90 make_opt = args.make[0]
91 except:
92 # This is the default build option
93 make_opt = -1
94 # Build all supported features
95 if make_opt == -1:
96
97 # Build documentation of PyXMake
98 BuildID = "pyx_core"
99 main(BuildID, ["PyXMake", "PyXMake Developer Guide"],
100 [x[0] for x in Utility.PathWalk(PyXMakePath,True, startswith=(".","__"), contains=("config","doc"), endswith=("make"))], "Python",
101 output=os.path.join(PyXMakePath,"VTL","doc","pyx_core"))
102
103 # Build documentation of PyCODAC
104 BuildID = "pyc_core"
105 main(BuildID, ["PyCODAC", "PyCODAC Developer Guide"],
106 [x[0] for x in Utility.PathWalk(PyCODACPath, True, startswith=(".","__"),
107 contains=("external","config","doc","src","cmd","solver","Smetana","TexGen"),
108 endswith=("make"))], "Python",
109 output=os.path.join(GetPyCODACPath(),"VTL","doc","mcd_pycodac"))
110
111 # Build documentation of SubBuckling
112 BuildID = "mcd_subbuck"
113 main(BuildID, ["SubBuck", "SubLaminate Buckling Developer Guide"],
114 [x[0] for x in Utility.PathWalk(os.path.join(Utility.AsDrive("D"),"03_Workspaces","01_Eclipse","mcd_subbuckling"))], "Java",
115 output=os.path.join(GetPyCODACPath(),"VTL","doc","mcd_subbuckling"))
116
117 # Build documentation of Mapper
118 BuildID = "mcd_mapper"
119 main(BuildID, ["Mapper", "Damage Mapping Developer Guide"],
120 [x[0] for x in Utility.PathWalk(os.path.join(Utility.AsDrive("D"),"03_Workspaces","01_Eclipse","mcd_mapper"))], "Java",
121 output=os.path.join(GetPyCODACPath(),"VTL","doc","mcd_mapper"))
122
123 # Build documentation of BoxBeam
124 BuildID = "box_main"
125 main(BuildID, ["BoxBeam", "BoxBeam Developer Guide"], VTL.GetSourceCode(1),
126 source=os.path.join(__mcd_core_path,"external","boxbeam"),
127 output=os.path.join(GetPyCODACPath(),"Plugin","BoxBeam","VTL","doc","box_core"))
128
129 # Build documentation of MCODAC (Default settings
130 BuildID = 'mcd_core'
131 main(BuildID)
132
133 else:
134 raise NotImplementedError
135
136 # Finish
137 print("==================================")
138 print("Finished building HTML documentations")
139 print("==================================")
140 sys.exit()
PyXMake.Tools
Module containing basic functionalities defined for convenience.
Definition: __init__.py:1
PyXMake.VTL.doxygen.main
def main(BuildID, title=["MCODAC", MCODAC, Developer, Guide, files=VTL.GetSourceCode(0), ftype="Fortran", source=os.path.join(__mcd_core_path,"src"), output=os.path.join(os.path.dirname(__mcd_core_path),"VTL","doc","mcd_core"), scratch=VTL.Scratch, verbosity=0, kwargs)
Definition: doxygen.py:63
PyXMake.Build
Module containing all relevant modules and scripts associated with the building process.
Definition: __init__.py:1