Docker image builds: move doxygen handling to a separate function.
authorM. Eric Irrgang <ericirrgang@gmail.com>
Thu, 28 May 2020 11:00:46 +0000 (14:00 +0300)
committerM. Eric Irrgang <ericirrgang@gmail.com>
Thu, 28 May 2020 11:45:10 +0000 (14:45 +0300)
admin/containers/scripted_gmx_docker_builds.py

index 90ec00337afd76bab8763998bba94b9235695f59..2e20069386e13645c8f5e773f00ff70526170b95 100644 (file)
@@ -402,6 +402,33 @@ def add_python_stages(building_blocks: typing.Mapping[str, bb_base],
     output_stages['pyenv'] = pyenv_stage
 
 
+def add_doxygen_stages(input_args,
+                       output_stages: typing.MutableMapping[str, hpccm.Stage]):
+    """Add appropriate stages according to doxygen input arguments."""
+    if input_args.doxygen is None:
+        return
+    if (input_args.doxygen == '1.8.5'):
+        doxygen_commit = 'ed4ed873ab0e7f15116e2052119a6729d4589f7a'
+    else:
+        doxygen_commit = 'a6d4f4df45febe588c38de37641513fd576b998f'
+    output_stages['main'] += hpccm.building_blocks.generic_autotools(
+        repository='https://github.com/westes/flex.git',
+        commit='f7788a9a0ecccdc953ed12043ccb59ca25714018',
+        prefix='/tmp/install-of-flex',
+        configure_opts=['--disable-shared'],
+        preconfigure=['./autogen.sh'])
+    output_stages['main'] += hpccm.building_blocks.generic_autotools(
+        repository='https://github.com/doxygen/doxygen.git',
+        commit=doxygen_commit,
+        prefix='',
+        configure_opts=[
+            '--flex /tmp/install-of-flex/bin/flex',
+            '--static'],
+        postinstall=[
+            'sed -i \'/\"XPS\"/d;/\"PDF\"/d;/\"PS\"/d;/\"EPS\"/d;/disable ghostscript format types/d\' /etc/ImageMagick-6/policy.xml'])
+    output_stages['main'] += hpccm.building_blocks.pip(pip='pip3', packages=['sphinx==1.6.1'])
+
+
 def build_stages(args) -> typing.Iterable[hpccm.Stage]:
     """Define and sequence the stages for the recipe corresponding to *args*."""
 
@@ -455,27 +482,8 @@ def build_stages(args) -> typing.Iterable[hpccm.Stage]:
                                                 packages=['pytest', 'networkx', 'numpy'])
 
     # Add documentation requirements (doxygen and sphinx + misc).
-    if (args.doxygen is not None):
-        if (args.doxygen == '1.8.5'):
-            doxygen_commit = 'ed4ed873ab0e7f15116e2052119a6729d4589f7a'
-        else:
-            doxygen_commit = 'a6d4f4df45febe588c38de37641513fd576b998f'
-        stages['main'] += hpccm.building_blocks.generic_autotools(
-            repository='https://github.com/westes/flex.git',
-            commit='f7788a9a0ecccdc953ed12043ccb59ca25714018',
-            prefix='/tmp/install-of-flex',
-            configure_opts=['--disable-shared'],
-            preconfigure=['./autogen.sh'])
-        stages['main'] += hpccm.building_blocks.generic_autotools(
-            repository='https://github.com/doxygen/doxygen.git',
-            commit=doxygen_commit,
-            prefix='',
-            configure_opts=[
-                '--flex /tmp/install-of-flex/bin/flex',
-                '--static'],
-            postinstall=[
-                'sed -i \'/\"XPS\"/d;/\"PDF\"/d;/\"PS\"/d;/\"EPS\"/d;/disable ghostscript format types/d\' /etc/ImageMagick-6/policy.xml'])
-        stages['main'] += hpccm.building_blocks.pip(pip='pip3', packages=['sphinx==1.6.1'])
+    if args.doxygen is not None:
+        add_doxygen_stages(args, stages)
 
     if 'pyenv' in stages and stages['pyenv'] is not None:
         stages['main'] += hpccm.primitives.copy(_from='pyenv', _mkdir=True, src=['/root/.pyenv/'],