diff options
-rwxr-xr-x | dlpcvp.py | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -115,6 +115,27 @@ def update_etags(con: sqlite3.Connection, pkg: str, con.commit() +def is_develpackage(proj: str, pkg: str) -> bool: + req = Request(url=OBS_base + f'/source/openSUSE:Factory/{pkg}/_meta') + log.debug('Looking up URL: %s', req.full_url) + try: + with opener.open(req) as resp: + xml_data = ET.parse(resp) + for pel in xml_data.iter('package'): + for delem in pel.iter('devel'): + if pel.attrib['name'] == pkg and \ + delem.attrib['package'] == pkg and \ + delem.attrib['project'] == proj: + return True + return False + except HTTPError as ex: + if ex.getcode() == 404: + log.warning(f'Cannot acquire _meta of {pkg}.') + return None + else: + raise + + def parse_spec(spec_file: Union[str, bytes]) -> LooseVersion: if isinstance(spec_file, bytes): spec_file = spec_file.decode() @@ -260,6 +281,8 @@ def main(prj): suse_ver = package_version(prj, pkg, conn) if suse_ver is None: raise RuntimeError('not in OBS') + if not is_develpackage(prj, pkg): + continue pypi_ver = get_version_from_pypi(pypi_name, conn) if pypi_ver is None: raise RuntimeError('not in PyPI') |