diff options
author | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2016-09-17 20:30:13 +0200 |
---|---|---|
committer | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2016-09-17 20:30:13 +0200 |
commit | 07fdce28e407b0ec10b5fee682f134550eae335b (patch) | |
tree | 74baed3d9a1daa2ecd8d4bb3f00ff1e47c9f88d4 /tox/result.py | |
parent | 2237fc53240f8892577b3a54016dfcfe8be7fd56 (diff) | |
download | tox-master.tar.gz |
Diffstat (limited to 'tox/result.py')
-rw-r--r-- | tox/result.py | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/tox/result.py b/tox/result.py deleted file mode 100644 index bad8cc3..0000000 --- a/tox/result.py +++ /dev/null @@ -1,81 +0,0 @@ -import sys -import py -from tox import __version__ as toxver -import json - - -class ResultLog: - - def __init__(self, dict=None): - if dict is None: - dict = {} - self.dict = dict - self.dict.update({"reportversion": "1", "toxversion": toxver}) - self.dict["platform"] = sys.platform - self.dict["host"] = py.std.socket.getfqdn() - - def set_header(self, installpkg): - """ - :param py.path.local installpkg: Path ot the package. - """ - self.dict["installpkg"] = dict( - md5=installpkg.computehash("md5"), - sha256=installpkg.computehash("sha256"), - basename=installpkg.basename, - ) - - def get_envlog(self, name): - testenvs = self.dict.setdefault("testenvs", {}) - d = testenvs.setdefault(name, {}) - return EnvLog(self, name, d) - - def dumps_json(self): - return json.dumps(self.dict, indent=2) - - @classmethod - def loads_json(cls, data): - return cls(json.loads(data)) - - -class EnvLog: - def __init__(self, reportlog, name, dict): - self.reportlog = reportlog - self.name = name - self.dict = dict - - def set_python_info(self, pythonexecutable): - pythonexecutable = py.path.local(pythonexecutable) - out = pythonexecutable.sysexec("-c", - "import sys; " - "print(sys.executable);" - "print(list(sys.version_info)); " - "print(sys.version)") - lines = out.splitlines() - executable = lines.pop(0) - version_info = eval(lines.pop(0)) - version = "\n".join(lines) - self.dict["python"] = dict( - executable=executable, - version_info=version_info, - version=version) - - def get_commandlog(self, name): - l = self.dict.setdefault(name, []) - return CommandLog(self, l) - - def set_installed(self, packages): - self.dict["installed_packages"] = packages - - -class CommandLog: - def __init__(self, envlog, list): - self.envlog = envlog - self.list = list - - def add_command(self, argv, output, retcode): - d = {} - self.list.append(d) - d["command"] = argv - d["output"] = output - d["retcode"] = str(retcode) - return d |