From 37fd319ac608636d7753b44b3ba468a872b66f9b Mon Sep 17 00:00:00 2001 From: Pavlo Shchelokovskyy Date: Tue, 14 Feb 2017 16:09:48 +0200 Subject: [PATCH] Fix ansible-pip-version.py script The script uses 'isdecimal' method on strings but this is actually valid for unicode strings only. Cast to six.text_type before accessing this method. Change-Id: I032f4cc90140aba4eecd4317a9cd153989ed5add --- scripts/ansible-pip-str.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/ansible-pip-str.py b/scripts/ansible-pip-str.py index 8ce6635cb..45d1a9a6a 100644 --- a/scripts/ansible-pip-str.py +++ b/scripts/ansible-pip-str.py @@ -19,6 +19,8 @@ from __future__ import print_function import sys +import six + in_str = sys.argv[1] HELP_MSG = ("Unsupported version or format %s - " "Supporting format [stable-]MAJ.MIN where MAJ.MIN is 1.9 or 2.x" @@ -27,7 +29,7 @@ HELP_MSG = ("Unsupported version or format %s - " if in_str.startswith('stable-'): in_version = in_str.split('stable-')[1] else: - if in_str[0].isdecimal(): + if six.text_type(in_str[0]).isdecimal(): print("ansible==%s" % in_str) else: print("ansible%s" % in_str)