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