Filter pre_release versions of packages
Get-pypi-pkg-version should not return pre release versions. This comit filters them out with a simple regex. Change-Id: I3919fc1a9872250acc100e751f4b78cc857b3348
This commit is contained in:
parent
e8139b9261
commit
41f42be6cc
@ -24,12 +24,16 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import re
|
||||||
import xmlrpclib
|
import xmlrpclib
|
||||||
|
|
||||||
|
PRE_RELEASE_RE = re.compile('a|b|rc')
|
||||||
|
|
||||||
|
|
||||||
def get_package_version(pypiConn, pkg_name):
|
def get_package_version(pypiConn, pkg_name):
|
||||||
"""Get the current package version from PyPI."""
|
"""Get the current package version from PyPI."""
|
||||||
pkg_result = pypiConn.package_releases(pkg_name)
|
pkg_result = [v for v in pypiConn.package_releases(pkg_name, True)
|
||||||
|
if not PRE_RELEASE_RE.search(v)]
|
||||||
if pkg_result:
|
if pkg_result:
|
||||||
pkg_version = pkg_result[0]
|
pkg_version = pkg_result[0]
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user