Changeset View
Changeset View
Standalone View
Standalone View
swh/web/misc/coverage.py
Show First 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | "origins": [ | ||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
"type": "launchpad", | "type": "launchpad", | ||||
"info_url": "https://launchpad.net", | "info_url": "https://launchpad.net", | ||||
"logo": "img/logos/launchpad.png", | "logo": "img/logos/launchpad.png", | ||||
"info": "public repositories from Launchpad", | "info": "public repositories from Launchpad", | ||||
"search_pattern": { | "search_pattern": { | ||||
"default": "https://git.launchpad.net/", | "default": "launchpad.net/", | ||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
"type": "maven", | "type": "maven", | ||||
"info_url": "https://maven.apache.org/", | "info_url": "https://maven.apache.org/", | ||||
"info": "java source packages from maven repositories", | "info": "java source packages from maven repositories", | ||||
"search_pattern": { | "search_pattern": { | ||||
"default": "maven", | "default": "maven", | ||||
"cvs": "", | |||||
"git": "", | |||||
"hg": "", | |||||
"svn": "", | |||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
"type": "nixos", | "type": "nixos", | ||||
"info_url": "https://nixos.org", | "info_url": "https://nixos.org", | ||||
"info": "source code tarballs used to build the Nix package collection", | "info": "source code tarballs used to build the Nix package collection", | ||||
"visit_types": ["nixguix"], | "visit_types": ["nixguix"], | ||||
"search_pattern": { | "search_pattern": { | ||||
Show All 10 Lines | "origins": [ | ||||
"default": "https://www.npmjs.com", | "default": "https://www.npmjs.com", | ||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
"type": "opam", | "type": "opam", | ||||
"info_url": "https://opam.ocaml.org/", | "info_url": "https://opam.ocaml.org/", | ||||
"info": "public packages from the source-based package manager for OCaml", | "info": "public packages from the source-based package manager for OCaml", | ||||
"search_pattern": { | "search_pattern": { | ||||
"default": "opam+https://opam.ocaml.org/", | "default": "opam+https://", | ||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
"type": "Packagist", | "type": "Packagist", | ||||
"info_url": "https://packagist.org/", | "info_url": "https://packagist.org/", | ||||
"info": "source code repositories referenced by The PHP Package Repository", | "info": "source code repositories referenced by The PHP Package Repository", | ||||
"search_pattern": { | "search_pattern": { | ||||
"default": "", | "default": "", | ||||
▲ Show 20 Lines • Show All 255 Lines • ▼ Show 20 Lines | for origins in listed_origins["origins"]: | ||||
origins["instances"] = dict(origins["instances"]) | origins["instances"] = dict(origins["instances"]) | ||||
for origins in listed_origins["origins"]: | for origins in listed_origins["origins"]: | ||||
instances = origins["instances"] | instances = origins["instances"] | ||||
nb_instances = len(instances) | nb_instances = len(instances) | ||||
for instance_name, visit_types in instances.items(): | for instance_name, visit_types in instances.items(): | ||||
for visit_type in visit_types: | for visit_type in visit_types: | ||||
search_url = "" | search_url = "" | ||||
if nb_instances > 1: | |||||
search_pattern = instance_name | |||||
else: | |||||
if visit_type in origins["search_pattern"]: | if visit_type in origins["search_pattern"]: | ||||
search_pattern = origins["search_pattern"][visit_type] | search_pattern = origins["search_pattern"][visit_type] | ||||
elif nb_instances > 1: | |||||
search_pattern = instance_name | |||||
else: | else: | ||||
search_pattern = origins["search_pattern"]["default"] | search_pattern = origins["search_pattern"]["default"] | ||||
if search_pattern: | if search_pattern: | ||||
search_url = _search_url(search_pattern, visit_type) | search_url = _search_url(search_pattern, visit_type) | ||||
visit_types[visit_type]["search_url"] = search_url | visit_types[visit_type]["search_url"] = search_url | ||||
# filter out origin types without archived origins on production and staging | # filter out origin types without archived origins on production and staging | ||||
if not is_swh_web_development(request): | if not is_swh_web_development(request): | ||||
listed_origins["origins"] = list( | listed_origins["origins"] = list( | ||||
filter(lambda o: o["count"] != "0", listed_origins["origins"]) | filter(lambda o: o["count"] != "0", listed_origins["origins"]) | ||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |