Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/maven/lister.py
Show First 20 Lines • Show All 255 Lines • ▼ Show 20 Lines | def get_pages(self) -> Iterator[RepoPage]: | ||||
# Now fetch pom files and scan them for scm info. | # Now fetch pom files and scan them for scm info. | ||||
logger.info("Fetching poms..") | logger.info("Fetching poms..") | ||||
for pom in out_pom: | for pom in out_pom: | ||||
try: | try: | ||||
response = self.page_request(pom, {}) | response = self.page_request(pom, {}) | ||||
project = xmltodict.parse(response.content.decode()) | project = xmltodict.parse(response.content.decode()) | ||||
if "scm" in project["project"]: | project_d = project.get("project", {}) | ||||
if "connection" in project["project"]["scm"]: | scm_d = project_d.get("scm") | ||||
scm = project["project"]["scm"]["connection"] | if scm_d is not None: | ||||
gid = project["project"]["groupId"] | connection = scm_d.get("connection") | ||||
aid = project["project"]["artifactId"] | if connection is not None: | ||||
scm = connection | |||||
gid = project_d["groupId"] | |||||
aid = project_d["artifactId"] | |||||
artifact_metadata_d = { | artifact_metadata_d = { | ||||
"type": "scm", | "type": "scm", | ||||
"doc": out_pom[pom], | "doc": out_pom[pom], | ||||
"url": scm, | "url": scm, | ||||
"project": f"{gid}.{aid}", | "project": f"{gid}.{aid}", | ||||
} | } | ||||
logger.debug("* Yielding pom %s: %s", pom, artifact_metadata_d) | logger.debug("* Yielding pom %s: %s", pom, artifact_metadata_d) | ||||
yield artifact_metadata_d | yield artifact_metadata_d | ||||
▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines |