From 803952bc7934128bd6573d2fb0f391492093c584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20=E2=80=9CKwpolska=E2=80=9D=20Warrick?= Date: Sun, 2 Feb 2014 09:57:00 +0100 Subject: [PATCH] update the getpyver script as bugfix releases are not distinguished by wheels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chris “Kwpolska” Warrick --- scripts/getpyver.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/scripts/getpyver.py b/scripts/getpyver.py index 9ec318ac3d..b5f83b0320 100755 --- a/scripts/getpyver.py +++ b/scripts/getpyver.py @@ -1,13 +1,25 @@ #!/usr/bin/env python # For internal use only. -"""Return the Python version in a sane format (vX.Y.Z). +"""Return the Python version in a sane format (vX.Y). -Also available a less sane format (X.Y.Z) if `short` is provided +Also available a less sane format (X.Y) if `short` is provided as an argument. +Or ([v]X.Y.Z) if `long` is provided. + +$ getpyver.py +v2.7 +$ getpyver.py short +2.7 +$ getpyver.py long +v2.7.6 +$ getpyver.py long short +2.7.6 + """ import sys +limit = 3 if 'long' in sys.argv else 2 if 'short' in sys.argv: - print(".".join([str(i) for i in sys.version_info[0:3]])) + print(".".join([str(i) for i in sys.version_info[0:limit]])) else: - print("v" + (".".join([str(i) for i in sys.version_info[0:3]]))) + print("v" + (".".join([str(i) for i in sys.version_info[0:limit]])))