Package files

def package(dest, tardir, p_version):
    """Package files"""
    os.chdir(dest)
    p_filename = '%s.tar.gz' % p_version
    p_path = os.path.join(tardir, p_filename)
    tar = tarfile.open(p_path, mode='w:gz')
    for cf_file in os.listdir('.'):
        if os.path.isfile(cf_file):
            tar.add(cf_file)
    tar.close()