From 2a461d6b395e098996b8b55a6c7e64d25b10ced6 Mon Sep 17 00:00:00 2001 From: Nikhil Soni Date: Sat, 18 Feb 2017 06:27:06 +0530 Subject: [PATCH 1/2] Adds PyInstaller build indicator to --version argument --- mitmproxy/utils/debug.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mitmproxy/utils/debug.py b/mitmproxy/utils/debug.py index ff98b86cf..c2eee2b6c 100644 --- a/mitmproxy/utils/debug.py +++ b/mitmproxy/utils/debug.py @@ -37,8 +37,12 @@ def dump_system_info(): except: pass + bin_indicator = "" # PyInstaller builds indicator, if using precompiled binary + if getattr(sys, 'frozen', False): + bin_indicator = "Precompiled Binary" + data = [ - "Mitmproxy version: {} ({})".format(version.VERSION, git_describe), + "Mitmproxy version: {} ({}) {}".format(version.VERSION, git_describe, bin_indicator), "Python version: {}".format(platform.python_version()), "Platform: {}".format(platform.platform()), "SSL version: {}".format(SSL.SSLeay_version(SSL.SSLEAY_VERSION).decode()), From ed084f5413938d3246980c7885d37b7de8897916 Mon Sep 17 00:00:00 2001 From: Nikhil Soni Date: Sun, 19 Feb 2017 19:15:36 +0530 Subject: [PATCH 2/2] Adds test for pyinstaller indicator --- test/mitmproxy/utils/test_debug.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/mitmproxy/utils/test_debug.py b/test/mitmproxy/utils/test_debug.py index 22f8dc669..b6d6407cf 100644 --- a/test/mitmproxy/utils/test_debug.py +++ b/test/mitmproxy/utils/test_debug.py @@ -1,11 +1,13 @@ import io import subprocess +import sys from unittest import mock from mitmproxy.utils import debug def test_dump_system_info(): + setattr(sys, 'frozen', True) assert debug.dump_system_info() with mock.patch('subprocess.check_output') as m: