PyXMake Developer Guide  1.0
PyXMake
D:/03_Workspaces/01_Eclipse/pyx_core/PyXMake/VTL/sphinx.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 documentations for PyXMake, PyCODAC and STMLab with Sphinx.
10 Created on 05.08.2020
11 
12 @version: 1.0
13 ----------------------------------------------------------------------------------------------
14 @requires:
15  - PyXMake, PyCODAC
16 
17 @change:
18  -
19 
20 @author: garb_ma [DLR-FA,STM Braunschweig]
21 ----------------------------------------------------------------------------------------------
22 """
23 import os, sys
24 import argparse
25 
26 try:
27  import PyXMake as _
28 except ImportError:
29  # Script is executed as a plug-in
30  sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
31 finally:
32  from PyXMake.Build import Make as pyx
33  from PyXMake.Tools import Utility
34  from PyXMake import VTL
35 
36 # Predefined script local variables
37 __arch = Utility.GetArchitecture()
38 __platform = Utility.GetPlatform()
39 
40 try:
41  # Import PyCODAC to build library locally during setup.
42  from PyCODAC.Tools.Utility import GetPyCODACPath
43  # Import and set local path to PyCODAC
44  __pyc_core_path = GetPyCODACPath()
45 except ImportError:
46  # This script is not executed as plug-in
47  __pyc_core_path = ""
48 except:
49  # Something else went wrong.
50  from PyXMake.Tools import ErrorHandling
51  ErrorHandling.InputError(20)
52 
53 def main(
54  # Mandatory arguments
55  BuildID, masterfile,
56  # Resource paths
57  source = os.path.join(__pyc_core_path,"VTL","doc","mcd_stmlab","source") ,
58  output= os.path.join(__pyc_core_path,"VTL","doc","mcd_stmlab"),
59  include=[os.path.join(__pyc_core_path,"Plugin","Smetana"),
60  os.path.join(__pyc_core_path,"Plugin","Smetana","src","Smetana"),
61  os.path.join(__pyc_core_path,"Core","bin",__platform,__arch)],
62  scratch=VTL.Scratch, verbosity=2,
63  **kwargs):
64  """
65  Main function to execute the script.
66  """
67  # Modify the current path variable
68  SphinxBuild = pyx.Sphinx(BuildID, masterfile, scratch=scratch, verbose=verbosity)
69  SphinxBuild .SourcePath(source)
70  SphinxBuild .AddIncludePath(include)
71  SphinxBuild.OutputPath(output)
72  SphinxBuild.Settings(**kwargs)
73  SphinxBuild.create()
74 
75 if __name__ == '__main__':
76 # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77 # % Access command line inputs %
78 # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
79  parser = argparse.ArgumentParser(description="Build shared Fortran libraries for Python remotely on the institute cluster.")
80  parser.add_argument("user", metavar="user", nargs=1, help="Current user for SSH connection")
81 
82  try:
83  _ = sys.argv[1]
84  args, _ = parser.parse_known_args()
85  except:
86  pass
87 
88  try:
89  # SSH key informations
90  user = args.user[0]
91  key = args.key[0]
92  except:
93  main("Structural Mechanics Lab", "stm_lab", logo=os.path.join(__pyc_core_path,"VTL","doc","mcd_stmlab","pics","stm_lab_logo_bubbles.png"))
94  else:
95  # This is not implemented yet.
96  raise NotImplementedError
97 
98  # Finish
99  print("==================================")
100  print("Finished build with Sphinx")
101  print("==================================")
102  sys.exit()
Module containing basic functionalities defined for convenience.
Definition: __init__.py:1
Module containing all relevant modules and scripts associated with the building process.
Definition: __init__.py:1
def main(BuildID, masterfile, source=os.path.join(__pyc_core_path,"VTL","doc","mcd_stmlab","source"), output=os.path.join(__pyc_core_path,"VTL","doc","mcd_stmlab"), include=[os.path.join(__pyc_core_path,"Plugin","Smetana"), os, path, join, __pyc_core_path, Plugin, Smetana, src, Smetana, os, path, join, __pyc_core_path, Core, bin, __platform, __arch, scratch=VTL.Scratch, verbosity=2, kwargs)
Definition: sphinx.py:63