def __download(self):
        """Set download source based on user parameters"""

        # Use the default repository if set to True
        if self.repository is True:
            self.repository = self.__default_repository

        if not self.repository and not self.url:
            # 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<major>\d+)\.(?P<minor>\d+)', self.__version)
            major_minor = 'v{0}.{1}'.format(match.groupdict()['major'],
                                            match.groupdict()['minor'])
            tarball = 'openmpi-{}.tar.bz2'.format(self.__version)
            self.url = '{0}/{1}/downloads/{2}'.format(
                self.__baseurl, major_minor, tarball)
Set download source based on user parameters
hpccm/building_blocks/openmpi.py