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:
Hugh Saunders 2016-09-21 11:02:50 +01:00 committed by Jesse Pretorius (odyssey4me)
parent e8139b9261
commit 41f42be6cc

View File

@ -24,12 +24,16 @@
from __future__ import print_function
import argparse
import re
import xmlrpclib
PRE_RELEASE_RE = re.compile('a|b|rc')
def get_package_version(pypiConn, pkg_name):
"""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:
pkg_version = pkg_result[0]
else: