diff options
Diffstat (limited to 'release/scripts/modules')
-rw-r--r-- | release/scripts/modules/sys_info.py | 76 |
1 files changed, 31 insertions, 45 deletions
diff --git a/release/scripts/modules/sys_info.py b/release/scripts/modules/sys_info.py index f402d3f0d0f..8ca3014a31e 100644 --- a/release/scripts/modules/sys_info.py +++ b/release/scripts/modules/sys_info.py @@ -26,29 +26,9 @@ import bgl import sys -def cutPoint(text, length): - """Returns position of the last space found before 'length' chars""" - l = length - c = text[l] - while c != ' ': - l -= 1 - if l == 0: - return length # no space found - c = text[l] - return l - - -def textWrap(text, length=70): - lines = [] - while len(text) > 70: - cpt = cutPoint(text, length) - line, text = text[:cpt], text[cpt + 1:] - lines.append(line) - lines.append(text) - return lines - - def write_sysinfo(op): + import textwrap + output_filename = "system-info.txt" output = bpy.data.texts.get(output_filename) @@ -57,6 +37,17 @@ def write_sysinfo(op): else: output = bpy.data.texts.new(name=output_filename) + # pretty repr + def prepr(v): + r = repr(v) + vt = type(v) + if vt is bytes: + r = r[2:-1] + elif vt is list or vt is tuple: + r = r[1:-1] + return r + + header = "= Blender %s System Information =\n" % bpy.app.version_string lilies = "%s\n\n" % (len(header) * "=") firstlilies = "%s\n" % (len(header) * "=") @@ -67,27 +58,22 @@ def write_sysinfo(op): # build info output.write("\nBlender:\n") output.write(lilies) - if bpy.app.build_branch and bpy.app.build_branch != "Unknown": - output.write("version %s, branch %r, commit date %r %r, hash %r, %r\n" % - (bpy.app.version_string, - bpy.app.build_branch, - bpy.app.build_commit_date, - bpy.app.build_commit_time, - bpy.app.build_hash, - bpy.app.build_type)) - else: - output.write("version %s, revision %r. %r\n" % - (bpy.app.version_string, - bpy.app.build_change, - bpy.app.build_type)) - - output.write("build date: %r, %r\n" % (bpy.app.build_date, bpy.app.build_time)) - output.write("platform: %r\n" % (bpy.app.build_platform)) - output.write("binary path: %r\n" % (bpy.app.binary_path)) - output.write("build cflags: %r\n" % (bpy.app.build_cflags)) - output.write("build cxxflags: %r\n" % (bpy.app.build_cxxflags)) - output.write("build linkflags: %r\n" % (bpy.app.build_linkflags)) - output.write("build system: %r\n" % (bpy.app.build_system)) + output.write("version: %s, branch: %s, commit date: %s %s, hash: %s, type: %s\n" % + (bpy.app.version_string, + prepr(bpy.app.build_branch), + prepr(bpy.app.build_commit_date), + prepr(bpy.app.build_commit_time), + prepr(bpy.app.build_hash), + prepr(bpy.app.build_type), + )) + + output.write("build date: %s, %s\n" % (prepr(bpy.app.build_date), prepr(bpy.app.build_time))) + output.write("platform: %s\n" % prepr(bpy.app.build_platform)) + output.write("binary path: %s\n" % prepr(bpy.app.binary_path)) + output.write("build cflags: %s\n" % prepr(bpy.app.build_cflags)) + output.write("build cxxflags: %s\n" % prepr(bpy.app.build_cxxflags)) + output.write("build linkflags: %s\n" % prepr(bpy.app.build_linkflags)) + output.write("build system: %s\n" % prepr(bpy.app.build_system)) # python info output.write("\nPython:\n") @@ -175,9 +161,9 @@ def write_sysinfo(op): output.write("extensions:\n") glext = bgl.glGetString(bgl.GL_EXTENSIONS) - glext = textWrap(glext, 70) + glext = textwrap.wrap(glext, 70) for l in glext: - output.write("\t\t%r\n" % (l)) + output.write("\t%s\n" % l) output.write("\nImplementation Dependent OpenGL Limits:\n") output.write(lilies) |