def __distro(self):
        """Based on the Linux distribution, set values accordingly.  A user
        specified value overrides any defaults."""

        if self.__source:
            # Build dependencies
            if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
                self.__ospackages = ['bzip2', 'file', 'gcc', 'g++', 'git',
                                     'make', 'perl', 'tar', 'wget', 'xz-utils']
            elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
                self.__ospackages = ['bzip2', 'file', 'gcc', 'gcc-c++', 'git',
                                     'make', 'perl', 'tar', 'wget', 'xz']
            else: # pragma: no cover
                raise RuntimeError('Unknown Linux distribution')

        else:
            # Set libfortran version depending on the Ubuntu version
            if self.__fortran:
                if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
                    if hpccm.config.g_linux_version >= Version('20.0'):
                        self.__runtime_debs.append('libgfortran5')
                    elif hpccm.config.g_linux_version >= Version('18.0'):
                        self.__runtime_debs.append('libgfortran4')
                    elif hpccm.config.g_linux_version >= Version('16.0'):
                        self.__runtime_debs.append('libgfortran3')
                    else: # pragma: no cover
                        raise RuntimeError('Unrecognized Ubuntu version')

            # Setup the environment so that the alternate compiler version
            # is the new default
            if self.__version:
                alternatives = {}
                if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
                    if self.__cc:
                        alternatives['gcc'] = '$(which gcc-{})'.format(
                            self.__version)
                    if self.__cxx:
                        alternatives['g++'] = '$(which g++-{})'.format(
                            self.__version)
                    if self.__fortran:
                        alternatives['gfortran'] = '$(which gfortran-{})'.format(
                            self.__version)
                    alternatives['gcov'] = '$(which gcov-{})'.format(
                        self.__version)
                elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
                    # Default for CentOS 7
                    toolset_path = '/opt/rh/devtoolset-{}/root/usr/bin'.format(
                        self.__version)
                    if hpccm.config.g_linux_version >= Version('8.0'):
                        # CentOS 8
                        toolset_path = '/opt/rh/gcc-toolset-{}/root/usr/bin'.format(self.__version)

                    if self.__cc:
                        alternatives['gcc'] = posixpath.join(toolset_path, 'gcc')
                    if self.__cxx:
                        alternatives['g++'] = posixpath.join(toolset_path, 'g++')
                    if self.__fortran:
                        alternatives['gfortran'] = posixpath.join(toolset_path,
                                                                  'gfortran')
                    alternatives['gcov'] = posixpath.join(toolset_path, 'gcov')

                else: # pragma: no cover
                    raise RuntimeError('Unknown Linux distribution')

                for tool,alt in sorted(alternatives.items()):
                    self.__commands.append('update-alternatives --install {0} {1} {2} 30'.format(posixpath.join('/usr/bin', tool), tool, alt))
Based on the Linux distribution, set values accordingly.  A user
        specified value overrides any defaults.
hpccm/building_blocks/gnu.py