'This method may be used as a _build_and_install() implementation
for subclasses if they implement _build_and_install_current_dir().
Extracts the .tar.gz file, chdirs into the extracted directory
(which is assumed to match the tar filename) and calls
_build_and_isntall_current_dir from there.
Afterwards the build (regardless of failure) extracted .tar.gz
directory is cleaned up.
:return: True on success, False otherwise.
:raise OSError If the expected extraction directory does not exist.'

def _build_and_install_from_package(self, install_dir):

    self._extract_compressed_package()
    if self.verified_package.endswith('.tar.gz'):
        extension = '.tar.gz'
    elif self.verified_package.endswith('.tar.bz2'):
        extension = '.tar.bz2'
    elif self.verified_package.endswith('.zip'):
        extension = '.zip'
    else:
        raise Error(('Unexpected    package    file    extension    on    %s' % self.verified_package))
    os.chdir(os.path.dirname(self.verified_package))
    os.chdir(self.local_filename[:(- len(extension))])
    extracted_dir = os.getcwd()
    try:
        return self._build_and_install_current_dir(install_dir)
    finally:
        os.chdir(os.path.join(extracted_dir, '..'))
        shutil.rmtree(extracted_dir)
