From f70d870a63f7c75d89518ad33ea486e63f9ac75f Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Thu, 21 Mar 2019 19:28:18 +0100 Subject: [WIP] Check whether the package is actually a devel package for Factory. --- dlpcvp.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dlpcvp.py b/dlpcvp.py index c786741..b4dacb6 100755 --- a/dlpcvp.py +++ b/dlpcvp.py @@ -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') -- cgit From 73bcdf97f6a55848e50f9a2329bc2138256102e4 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Fri, 22 Mar 2019 23:24:23 +0100 Subject: Remove setup.py --- setup.py | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 setup.py diff --git a/setup.py b/setup.py deleted file mode 100644 index 725a368..0000000 --- a/setup.py +++ /dev/null @@ -1,32 +0,0 @@ -import os - -from setuptools import setup - - -def read(fname): - with open(os.path.join(os.path.dirname(__file__), fname)) as inf: - return "\n" + inf.read().replace("\r\n", "\n") - - -setup( - name='dlp_check_version_PyPI', - version="0.1.0", - description='Check available versions of the upstream packages on PyPI', - author=u'Matěj Cepl', - author_email='mcepl@cepl.eu', - url='https://gitlab.com/mcepl/dlp_check_version_PyPI', - py_modules=['dlpcvp'], - long_description=read("README.rst"), - classifiers=[ - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Development Status :: 3 - Alpha", - "Environment :: Console", - "Intended Audience :: Information Technology", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Topic :: Software Development :: Libraries :: Python Modules", - ], - test_suite="test" -) -- cgit