summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-06-28 13:02:50 -0500
committerIan Cordasco <graffatcolmingov@gmail.com>2016-06-28 13:02:50 -0500
commitc9fb680dffa37517bbda76cc2b572d6f192508bd (patch)
tree4d8c1f93ab2be6618eb358b603db62839e40ca03 /src
parent2d3e277b1e0c0a24c30c611558692f95d14a8470 (diff)
downloadflake8-c9fb680dffa37517bbda76cc2b572d6f192508bd.tar.gz
Add python and platform details to --version
On Flake8 2.x we added the information about the implementation, version, and operating system to the --version output to make helping users easier. In short they can pretty simply just give us the output from flake8 --version And we can get a lot of the information that we need.
Diffstat (limited to 'src')
-rw-r--r--src/flake8/options/manager.py6
-rw-r--r--src/flake8/utils.py17
2 files changed, 21 insertions, 2 deletions
diff --git a/src/flake8/options/manager.py b/src/flake8/options/manager.py
index fe3b13b..c6a3fcb 100644
--- a/src/flake8/options/manager.py
+++ b/src/flake8/options/manager.py
@@ -236,8 +236,10 @@ class OptionManager(object):
def update_version_string(self):
"""Update the flake8 version string."""
- self.parser.version = (self.version + ' (' +
- self.generate_versions() + ')')
+ self.parser.version = (
+ self.version + ' (' + self.generate_versions() + ') ' +
+ utils.get_python_version()
+ )
def generate_epilog(self):
"""Create an epilog with the version and name of each of plugin."""
diff --git a/src/flake8/utils.py b/src/flake8/utils.py
index fbd15b9..68ed530 100644
--- a/src/flake8/utils.py
+++ b/src/flake8/utils.py
@@ -4,6 +4,7 @@ import fnmatch as _fnmatch
import inspect
import io
import os
+import platform
import re
import sys
@@ -290,3 +291,19 @@ def parameters_for(plugin):
parameters.pop('self', None)
return parameters
+
+
+def get_python_version():
+ """Find and format the python implementation and version.
+
+ :returns:
+ Implementation name, version, and platform as a string.
+ :rtype:
+ str
+ """
+ # The implementation isn't all that important.
+ try:
+ impl = platform.python_implementation() + " "
+ except AttributeError: # Python 2.5
+ impl = ''
+ return '%s%s on %s' % (impl, platform.python_version(), platform.system())