def __setup(self):
        """Construct the series of shell commands, i.e., fill in
           self.__commands"""

        # The download URL has the format MAJOR.MINOR in the path and
        # the tarball contains MAJOR.MINOR.REVISION, so pull apart the
        # full version to get the individual components.
        match = re.match(r'(?P<major>\d+)\.(?P<minor>\d+)\.(?P<revision>\d+)',
                         self.__version)
        major_minor = '{0}.{1}'.format(match.groupdict()['major'],
                                       match.groupdict()['minor'])

        tarball = 'julia-{0}-linux-{1}.tar.gz'.format(self.__version,
                                                      self.__arch_pkg)
        url = '{0}/{1}/{2}/{3}'.format(self.__baseurl, self.__arch_directory,
                                       major_minor, tarball)

        # 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))

        # "Install"
        self.__commands.append('cp -a {0} {1}'.format(
            posixpath.join(self.__wd, 'julia-{}'.format(self.__version)),
            self.__prefix))

        # Install packages
        if self.__cuda:
            self.__packages.extend(['CUDAapi', 'CUDAdrv', 'CUDAnative',
                                    'CuArrays'])
        if self.__packages:
            # remove duplicates
            self.__packages = sorted(list(set(self.__packages)))
            # convert into PackageSpec() entries
            self.__packages = map(
                lambda pkg: 'PackageSpec(name="{0}")'.format(pkg)
                if not pkg.startswith('PackageSpec')
                else pkg, self.__packages)
            # Comma separated list of package
            packages_csv = ', '.join('{}'.format(pkg)
                                     for pkg in self.__packages)
            julia = posixpath.join(self.__prefix, 'bin', 'julia')
            # Install packages in the default location alongside Julia
            # itself.
            julia = 'JULIA_DEPOT_PATH={0} {1}'.format(
                posixpath.join(self.__prefix, 'share', 'julia'), julia)
            self.__commands.append(
                '{0} -e \'using Pkg; Pkg.add([{1}])\''.format(julia,
                                                              packages_csv))

        # Startup file
        if self.__depot:
            # The "user" depot path mist be writable by the user
            # running the container.  Modify the Julia startup file to
            # modify the "user" depot from ~/.julia to another
            # location.
            startup = posixpath.join(self.__prefix, 'etc', 'julia',
                                     'startup.jl')
            self.__commands.append('echo "DEPOT_PATH[1] = \\"{0}\\"" >> {1}'.format(
                self.__depot, startup))

        # Set library path
        libpath = posixpath.join(self.__prefix, 'lib')
        if self.ldconfig:
            self.__commands.append(self.ldcache_step(directory=libpath))
        else:
            self.environment_variables['LD_LIBRARY_PATH'] = '{}:$LD_LIBRARY_PATH'.format(libpath)

        # Cleanup tarball and directory
        self.__commands.append(self.cleanup_step(
            items=[posixpath.join(self.__wd, tarball),
                   posixpath.join(self.__wd, 'julia-{}'.format(self.__version))]))

        # Setup environment
        self.environment_variables['PATH'] = '{}:$PATH'.format(
            posixpath.join(self.__prefix, 'bin'))
        if self.__history:
            self.environment_variables['JULIA_HISTORY'] = self.__history
Construct the series of shell commands, i.e., fill in
           self.__commands
hpccm/building_blocks/julia.py