Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __build(self):
"""Build from source"""
# The download URL has the format contains vMAJOR.MINOR in the
# path and the tarball contains MAJOR.MINOR.REVISION, so pull
# apart the full version to get the MAJOR and MINOR
# components.
match = re.match(r'(?P\d+)\.(?P\d+)', self.__version)
major_minor = '{0}.{1}'.format(match.groupdict()['major'],
match.groupdict()['minor'])
tarball = 'cmake-{}.tar.gz'.format(self.__version)
url = '{0}/v{1}/{2}'.format(self.__baseurl, major_minor, tarball)
# Include SSL packages
if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
self.__ospackages.append('libssl-dev')
elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
self.__ospackages.append('openssl-devel')
else: # pragma: no cover
raise RuntimeError('Unknown Linux distribution')
# Download source from web
self.__commands.append(self.download_step(url=url, directory=self.__wd))
self.__commands.append(self.untar_step(
tarball=posixpath.join(self.__wd, tarball), directory=self.__wd))
# Build and install
if not self.__bootstrap_opts:
self.__bootstrap_opts.append(
'--parallel={}'.format(self.__parallel))
self.__commands.append('cd {} && ./bootstrap --prefix={} {}'.format(
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')
elif self.__version and not self.__source:
# Setup the environment so that the alternate compiler version
# is the new default
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)
def __distro(self):
if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
if not self.__ospackages:
self.__ospackages = ['libnl-3-200', 'libnl-route-3-200',
'libnuma1']
elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
if not self.__ospackages:
if hpccm.config.g_linux_version >= StrictVersion('8.0'):
self.__ospackages = ['libnl3', 'numactl-libs']
else:
self.__ospackages = ['libnl', 'libnl3', 'numactl-libs']
else: # pragma: no cover
raise RuntimeError('Unknown Linux distribution')
def __distro(self):
"""Based on the Linux distribution, set values accordingly. A user
specified value overrides any defaults."""
if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
if not self.__ospackages:
self.__ospackages = ['bzip2', 'libbz2-dev', 'tar', 'wget',
'zlib1g-dev']
elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
if not self.__ospackages:
self.__ospackages = ['bzip2', 'bzip2-devel', 'tar', 'wget',
'which', 'zlib-devel']
else: # pragma: no cover
raise RuntimeError('Unknown Linux distribution')
def __distro(self):
"""Based on the Linux distribution, set values accordingly. A user
specified value overrides any defaults."""
if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
self.__directory_string = 'Ubuntu-16.04'
self.__package_string = 'Ubuntu_16.04'
self.__url_string = 'Ubuntu16.04'
self.__installer_template = 'arm-compiler-for-linux-{{}}_Generic-AArch64_{0}_aarch64-linux-deb.sh'.format(self.__directory_string)
if not self.__ospackages:
self.__ospackages = ['libc6-dev', 'lmod', 'python', 'tar',
'tcl', 'wget']
elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
if hpccm.config.g_linux_version >= StrictVersion('8.0'):
self.__directory_string = 'RHEL-8'
self.__package_string = 'RHEL_8'
self.__url_string = 'RHEL8'
else:
"""Based on the Linux distribution, set values accordingly. A user
specified value overrides any defaults."""
if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
if not self.__ospackages:
self.__ospackages = ['cpio', 'libnuma1', 'libpciaccess0',
'openssh-client', 'rpm2cpio', 'wget']
if self.__gnu:
self.__ospackages.append('libgfortran3')
self.__runtime_ospackages = ['libnuma1', 'libpciaccess0',
'openssh-client']
if self.__gnu:
self.__runtime_ospackages.append('libgfortran3')
self.__installer_template = 'cd / && rpm2cpio {} | cpio -id'
elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
if not self.__ospackages:
self.__ospackages = ['libpciaccess', 'numactl-libs',
'openssh-clients', 'wget']
if self.__gnu:
self.__ospackages.append('libgfortran')
self.__runtime_ospackages = ['libpciaccess', 'numactl-libs',
'openssh-clients']
if self.__gnu:
self.__runtime_ospackages.append('libgfortran')
# The RPM has dependencies on some CUDA libraries that are
# present, but not in the RPM database. Use --nodeps as a
# workaround.
self.__installer_template = 'rpm --install --nodeps {}'
else: # pragma: no cover