diff options
| author | 2014-03-09 03:14:40 +0100 | |
|---|---|---|
| committer | 2014-03-09 03:14:40 +0100 | |
| commit | fa50632a9d87c3989566fed3e49c160a132e0d14 (patch) | |
| tree | 81f58cc0dcfbb34710856b59c034bc47c53d91dc /scripts/getpyver.py | |
| parent | 2828399ba5cbb14502b023d4de1ba02f13dd5055 (diff) | |
Imported Upstream version 6.4.0upstream/6.4.0
Diffstat (limited to 'scripts/getpyver.py')
| -rwxr-xr-x | scripts/getpyver.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/getpyver.py b/scripts/getpyver.py new file mode 100755 index 0000000..b5f83b0 --- /dev/null +++ b/scripts/getpyver.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# For internal use only. +"""Return the Python version in a sane format (vX.Y). + +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:limit]])) +else: + print("v" + (".".join([str(i) for i in sys.version_info[0:limit]]))) |
