def project_list_family(apiurl, project, include_update=False): """ Determine the available projects within the same product family. Skips < SLE-12 due to format change. """ if project.endswith(':NonFree'): project = project[:-8] project_suffix = ':NonFree' else: project_suffix = '' if project == 'openSUSE:Factory': return [project + project_suffix] if project.endswith(':ARM') or project.endswith(':PowerPC'): return [project + project_suffix] count_original = project.count(':') def filter_sle_updates(p): return p.count(':') == count_original and (p.endswith(':GA') or (include_update and p.endswith(':Update'))) def filter_opensuse_updates(p): return p.count(':') == count_original or ( include_update and p.count(':') == count_original + 1 and p.endswith(':Update')) if project.startswith('SUSE:SLE'): project = ':'.join(project.split(':')[:2]) family_filter = filter_sle_updates else: family_filter = filter_opensuse_updates prefix = ':'.join(project.split(':')[:-1]) projects = project_list_prefix(apiurl, prefix) projects = list(filter(family_filter, projects)) if project_suffix: for i, project in enumerate(projects): if project.endswith(':Update'): projects[i] = project.replace(':Update', project_suffix + ':Update') else: projects[i] += project_suffix return projects
def project_list_family(apiurl, project): """ Determine the available projects within the same product family. Skips < SLE-12 due to format change. """ if project == 'openSUSE:Factory': return [project] count_original = project.count(':') if project.startswith('SUSE:SLE'): project = ':'.join(project.split(':')[:2]) family_filter = lambda p: p.count( ':') == count_original and p.endswith(':GA') else: family_filter = lambda p: p.count(':') == count_original prefix = ':'.join(project.split(':')[:-1]) projects = project_list_prefix(apiurl, prefix) return filter(family_filter, projects)
def project_list_family(apiurl, project, include_update=False): """ Determine the available projects within the same product family. Skips < SLE-12 due to format change. """ if project.endswith(':NonFree'): project = project[:-8] project_suffix = ':NonFree' else: project_suffix = '' if project == 'openSUSE:Factory': return [project + project_suffix] if project.endswith(':ARM') or project.endswith(':PowerPC'): return [project + project_suffix] count_original = project.count(':') if project.startswith('SUSE:SLE'): project = ':'.join(project.split(':')[:2]) family_filter = lambda p: p.count(':') == count_original and ( p.endswith(':GA') or (include_update and p.endswith(':Update'))) else: family_filter = lambda p: p.count(':') == count_original or ( include_update and p.count(':') == count_original + 1 and p.endswith(':Update')) prefix = ':'.join(project.split(':')[:-1]) projects = project_list_prefix(apiurl, prefix) projects = list(filter(family_filter, projects)) if project_suffix: for i, project in enumerate(projects): if project.endswith(':Update'): projects[i] = project.replace(':Update', project_suffix + ':Update') else: projects[i] += project_suffix return projects
def project_list_family(apiurl, project): """ Determine the available projects within the same product family. Skips < SLE-12 due to format change. """ if project == 'openSUSE:Factory': return [project] if project.endswith(':ARM') or project.endswith(':PowerPC'): return [project] count_original = project.count(':') if project.startswith('SUSE:SLE'): project = ':'.join(project.split(':')[:2]) family_filter = lambda p: p.count(':') == count_original and p.endswith(':GA') else: family_filter = lambda p: p.count(':') == count_original prefix = ':'.join(project.split(':')[:-1]) projects = project_list_prefix(apiurl, prefix) return filter(family_filter, projects)