Merge pull request #2041 from krsoninikhil/debug

Adds PyInstaller build indicator to --version argument
This commit is contained in:
Thomas Kriechbaumer 2017-02-20 10:29:15 +01:00 committed by GitHub
commit 51e08a5b85
2 changed files with 7 additions and 1 deletions

View File

@ -37,8 +37,12 @@ def dump_system_info():
except: except:
pass pass
bin_indicator = "" # PyInstaller builds indicator, if using precompiled binary
if getattr(sys, 'frozen', False):
bin_indicator = "Precompiled Binary"
data = [ data = [
"Mitmproxy version: {} ({})".format(version.VERSION, git_describe), "Mitmproxy version: {} ({}) {}".format(version.VERSION, git_describe, bin_indicator),
"Python version: {}".format(platform.python_version()), "Python version: {}".format(platform.python_version()),
"Platform: {}".format(platform.platform()), "Platform: {}".format(platform.platform()),
"SSL version: {}".format(SSL.SSLeay_version(SSL.SSLEAY_VERSION).decode()), "SSL version: {}".format(SSL.SSLeay_version(SSL.SSLEAY_VERSION).decode()),

View File

@ -1,11 +1,13 @@
import io import io
import subprocess import subprocess
import sys
from unittest import mock from unittest import mock
from mitmproxy.utils import debug from mitmproxy.utils import debug
def test_dump_system_info(): def test_dump_system_info():
setattr(sys, 'frozen', True)
assert debug.dump_system_info() assert debug.dump_system_info()
with mock.patch('subprocess.check_output') as m: with mock.patch('subprocess.check_output') as m: