diff options
-rwxr-xr-x | dlpcvp.py | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -108,14 +108,17 @@ def parse_spec(spec_file: str, pkg: str) -> LooseVersion: # rpm library generates awful lot of nonsensical goo on stderr if isinstance(spec_file, bytes): spec_file = spec_file.decode() + + rest_of_line = '' for line in spec_file.split('\n'): if line.startswith('Version:'): rest_of_line = line[len('Version:'):].strip() + break return LooseVersion(rest_of_line) -def get_spec_name(req: Request, pkg: str, etag: str = None) -> LooseVersion: +def get_spec_name(req: Request, pkg: str, etag: str = None) -> Optional[str]: # Acquire version from the listing of the project directory spec_files = [] @@ -149,7 +152,7 @@ def get_spec_name(req: Request, pkg: str, etag: str = None) -> LooseVersion: return -def get_version_from_pypi(name: str, con: sqlite3.Connection = None) -> Optional[Tuple[str, str]]: +def get_version_from_pypi(name: str, con: sqlite3.Connection = None) -> Optional[LooseVersion]: """ For the given name of module return the latest version available on PyPI. """ @@ -178,8 +181,7 @@ def get_version_from_pypi(name: str, con: sqlite3.Connection = None) -> Optional raise -def package_version(proj: str, pkg_name: str, con: sqlite3.Connection = None) \ - -> Optional[Tuple[str, str, str]]: +def package_version(proj: str, pkg_name: str, con: sqlite3.Connection = None) -> LooseVersion: """ Return the version of the given package in the given proj. |