ifw-daq  2.1.0-pre1
IFW Data Acquisition modules
conf.py
Go to the documentation of this file.
1 import subprocess
2 from typing import List
3 
4 from docutils.parsers.rst.directives.admonitions import BaseAdmonition
5 from docutils import nodes
6 from sphinx.util.docutils import SphinxDirective
7 from sphinx import addnodes
8 
9 import sphinx_eso_theme
10 # Notes
11 # -----
12 #
13 # Raster images are assumed to be exported from Magicdraw in 288dpi png.
14 # To get a 1:1 size compared with what you see in Magicdraw the image must be scaled
15 # to 33%
16 
17 extensions = ['sphinx.ext.intersphinx',
18  'sphinx.ext.ifconfig',
19  'sphinx.ext.graphviz',
20  'sphinx.ext.mathjax',
21  'sphinxcontrib.plantuml',
22  'sphinx_eso_theme']
23 
24 source_suffix = '.rst'
25 
26 # The master toctree document.
27 master_doc = 'index'
28 
29 # Use numbered figures
30 numfig = True
31 # General information about the project.
32 project = 'IFW Data Acquisition User Manual'
33 # note the leading space which is required to avoid SOURCE_DATE_EPOCH being used.
34 copyright = ' 2022 ESO - European Southern Observatory'
35 homepage = r'https://gitlab.eso.org/ifw/ifw-daq'
36 
37 
38 #############################################################################
39 
40 rst_prolog = """
41 .. |configpath| replace:: :term:`Config Path`
42 .. |recif| replace:: :term:`recif`
43 .. |dpspec| replace:: :term:`Data Product Specification`
44 
45 .. |daq| replace:: :term:`Data Acquisition`
46 .. |daqs| replace:: :term:`Data Acquisitions <Data Acquisition>`
47 .. |dp| replace:: *Data Product*
48 .. |dps| replace:: *Data Products*
49 .. |ocm| replace:: :ref:`OCM<ocm>`
50 .. |dpm| replace:: :ref:`DPM<dpm>`
51 .. |olas| replace:: :ref:`OLAS<def-olas>`
52 .. |oldb| replace:: :ref:`OLDB<def-oldb>`
53 
54 .. |ocmserver| replace:: :ref:`daqOcmServer <daqOcmServer>`
55 .. |ocmctl| replace:: :ref:`daqOcmCtl <daqOcmCtl>`
56 .. |dpmserver| replace:: :ref:`daqDpmServer <daqDpmServer>`
57 .. |dpmmerge| replace:: :ref:`daqDpmMerge <daqDpmMerge>`
58 .. |dpmworkspace| replace:: :ref:`daqDpmServer workspace <dpmWorkspace>`
59 .. |rd1| replace:: :ref:`RD1 <rd1>`
60 .. |rd2| replace:: :ref:`RD2 <rd2>`
61 .. |rd3| replace:: :ref:`RD3 <rd3>`
62 .. |rd4| replace:: :ref:`RD4 <rd4>`
63 .. |rd-fits| replace:: :ref:`RD5 <rd5>`
64 .. |rd-esokw| replace:: :ref:`RD6 <rd6>`
65 .. |rd-olasicd| replace:: :ref:`RD7 <rd7>`
66 """
67 
68 #############################################################################
69 # Update for each release:
70 author='Rosenquist, Calle'
71 latex_attrs = dict(
72  pdm_version='n',
73  release_date='2021-xx-xx',
74  owner=author,
75  validated_pm='Kornweibel, Nick',
76  validated_se='González Herrera, Juan Carlos',
77  validated_pe='Biancat Marchet, Fabio',
78  approved_pgm='Tamai, Roberto')
79 
80 # The version info for the project you're documenting, acts as replacement for
81 # |version| and |release|, also used in various other places throughout the
82 # built documents.
83 #
84 # The short X.Y version.
85 version = '2.1.0-pre1'
86 prerelease = "-pre" in version
87 
88 # The full version, including alpha/beta/rc tags.
89 release = version
90 ifw_release = '4.0'
91 if prerelease:
92  try:
93  rev = subprocess.run(["git", "rev-parse", "--short=5", "HEAD"],
94  stdout=subprocess.PIPE).stdout.decode("utf-8")
95  suffix = "+git.%s" % rev
96  release += suffix
97  version += suffix
98  except Exception:
99  pass
100 #############################################################################
101 
102 
103 # The language for content autogenerated by Sphinx. Refer to documentation
104 # for a list of supported languages.
105 #
106 # This is also used if you do content translation via gettext catalogs.
107 # Usually you set "language" from the command line for these cases.
108 language = None
109 # List of patterns, relative to source directory, that match files and
110 # directories to ignore when looking for source files.
111 # This patterns also effect to html_static_path and html_extra_path
112 exclude_patterns = []
113 
114 # The name of the Pygments (syntax highlighting) style to use.
115 pygments_style = 'default'
116 # Disable default Python 3 highlighting in literal blocks `::`
117 highlight_language = 'none'
118 
119 # If true, `todo` and `todoList` produce output, else they produce nothing.
120 todo_include_todos = True
121 
122 plantuml_batch_size = 100
123 
124 # -- Options for HTML output ----------------------------------------------
125 
126 # The theme to use for HTML and HTML Help pages. See the documentation for
127 # a list of builtin themes.
128 #
129 html_theme = 'sphinx_eso_theme'
130 html_theme_path = ['_themes/', ]
131 html_show_sourcelink = False
132 html_copy_source = False
133 
134 # Theme options are theme-specific and customize the look and feel of a theme
135 # further. For a list of options available for each theme, see the
136 # documentation.
137 #
138 # html_theme_options = {}
139 
140 # Add any paths that contain custom static files (such as style sheets) here,
141 # relative to this directory. They are copied after the builtin static files,
142 # so a file named "default.css" will overwrite the builtin "default.css".
143 html_static_path = ['_static']
144 
145 #html_logo = '_static/eso_logo.png'
146 #html_favicon = '_static/eso-favicon.ico'
147 
148 # ESO customization of theme colors mostly.
149 html_context = {}
150 
151 
152 html_show_sphinx = False
153 
154 
155 # -- Options for LaTeX output ---------------------------------------------
156 # The ESO PDM style only supports the article class so we map manual to article class
157 # and set the top level sectioning to use 'section' as otherwise 'chapter' would be used, which is
158 # ignored for the article class.
159 latex_toplevel_sectioning = 'section'
160 latex_docclass = dict(manual='article')
161 latex_elements = {
162  # The paper size ('letterpaper' or 'a4paper').
163  #
164  'papersize': 'a4paper',
165 
166  # The font size ('10pt', '11pt' or '12pt').
167  #
168  'pointsize': '11pt',
169 
170  # Additional stuff for the LaTeX preamble.
171  #
172  'preamble':
173  r'''
174  \usepackage[public]{eso-pdm}
175  \pdmProgram{ELT}
176  \pdmProject{Instrumentation Framework}
177  \pdmTitle{ELT~ICS~Framework Data Acquisition\\User~Manual}
178  \pdmHeaderTitle{ELT~ICS~Framework - Data Acquisition - User~Manual}
179  \pdmDocId{ESO-396401}
180  \pdmDocVersion{%(pdm_version)s}
181  \pdmDocType{User Manual (MAN)}
182  \pdmDocDate{%(release_date)s}
183  \pdmSignatureList{
184  \pdmSignature{Owner}{%(owner)s}
185  \pdmSignature{Validated by PM}{%(validated_pm)s}
186  \pdmSignature{Validated by SE}{%(validated_se)s}
187  \pdmSignature{Validated by PE}{%(validated_pe)s}
188  \pdmSignature{Approved by PGM}{%(approved_pgm)s}
189  }
190  %% Disable pagestyle changes as it breaks ESO PDM style
191  \renewcommand{\pagestyle}[1]{}
192  ''' % latex_attrs,
193  # Latex figure (float) alignment
194  #
195  # 'figure_align': 'htbp',
196  'sphinxsetup': \
197  'hmargin={0.7in,0.7in}, vmargin={1in,1in}, \
198  verbatimwithframe=true, \
199  OuterLinkColor={rgb}{0,0,0.6}, \
200  InnerLinkColor={rgb}{0,0,0}, \
201  warningBorderColor={rgb}{0.8,0,0}, \
202  cautionBorderColor={rgb}{1,0.8,0}, \
203  TitleColor={rgb}{0,0,0}',
204  'printindex': r'\newpage',
205  'maketitle': r'''
206  \pdmmaketitle
207 
208  %% Scope redefinition of clearpage to relax to avoid new pages for each
209  \begingroup
210  \let\clearpage\relax
211 
212  \section*{Release}
213  This document corresponds to
214  \sphinxhref{%(homepage)s}{\texttt{ifw-hl}\footnote{\sphinxnolinkurl{%(homepage)s}}} v%(ifw_release)s.
215 
216  \section*{Authors}
217  \begin{tabularx}{\linewidth}{|p{0.25\linewidth}|X|}
218  \hline
219  \multicolumn{1}{|l|}{\textbf{Name}}\tbspa &
220  \multicolumn{1}{l|}{\textbf{Affiliation}} \tbspb\\
221  \hline
222  \tbspa %(author)s & ESO/DOE/CSE\tbspb\\ \hline
223  \end{tabularx}
224 
225  \section*{Change Record from previous Version}
226  \begin{tabularx}{\linewidth}{|p{0.25\linewidth}|X|}
227  \hline
228  \multicolumn{1}{|l|}{\textbf{Affected Section(s)}}\tbspa &
229  \multicolumn{1}{l|}{\textbf{Changes / Reason / Remarks}} \tbspb\\
230  \hline
231  \tbspa All & First version \tbspb\\ \hline
232  \end{tabularx}
233 
234  %% Restore \clearpage
235  \endgroup
236  \tymin=60pt
237  \tymax=\maxdimen
238  \hyphenation{Status-Topic}
239 
240  ''' % dict(release=release, ifw_release=ifw_release, author=author, homepage=homepage),
241  'tableofcontents': r'\tableofcontents\newpage',
242 }
243 
244 latex_show_urls = 'footnote'
245 
246 # Grouping the document tree into LaTeX files. List of tuples
247 # (source start file, target name, title,
248 # author, documentclass [howto, manual, or own class]).
249 latex_documents = [
250  ('index-latex', 'ELT_ICS_Framework_-_Data_Acquisition_-_User_Manual.tex',
251  'ELT ICS Framework - Data Acquisition - User Manual',
252  author, 'manual', False),
253 ]
254 
255 
256 class Internal(SphinxDirective, BaseAdmonition):
257 
258  required_arguments = 0
259  optional_arguments = 1
260  final_argument_whitespace = True
261  option_spec = {}
262  has_content = True
263  node_class = nodes.admonition
264 
265  def run(self) -> List[nodes.Node]:
266  self.options['class'] = ['attention']
267  if len(self.arguments) == 0:
268  self.arguments = ["Internal"]
269 
270  nodes = super().run()
271 
272  # Wrap nodes as children to ifconfig
273  node = addnodes.only()
274  self.set_source_info(node)
275  node['expr'] = "internal"
276  node.document = self.state.document
277  node.children = nodes
278  return [node]
279 
280 
281 def setup(app):
282  app.add_config_value('prerelease', False, 'env')
283  app.add_directive('internal', Internal)
conf.Internal.run
List[nodes.Node] run(self)
Definition: conf.py:265
conf.Internal
Definition: conf.py:256
conf.Internal.arguments
arguments
Definition: conf.py:268
conf.setup
def setup(app)
Definition: conf.py:281