diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-01-01 10:20:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-01-01 10:20:34 +0300 |
commit | 7f3fe8a2df0f5ecabdc87f441ca033b83c9fe575 (patch) | |
tree | 6ea076deb41524bf3b377e9ed26fc73b3d81f001 /release/scripts/modules/sys_info.py | |
parent | 2840e7b7645130f79cb92c5b899228c5ab826bd5 (diff) |
pep8 cleanup
Diffstat (limited to 'release/scripts/modules/sys_info.py')
-rw-r--r-- | release/scripts/modules/sys_info.py | 158 |
1 files changed, 81 insertions, 77 deletions
diff --git a/release/scripts/modules/sys_info.py b/release/scripts/modules/sys_info.py index 58fb1aba377..303277a5d75 100644 --- a/release/scripts/modules/sys_info.py +++ b/release/scripts/modules/sys_info.py @@ -25,83 +25,87 @@ 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 + "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): - output_filename = "system-info.txt" - warnings = 0 - notices = 0 - - if output_filename in bpy.data.texts.keys(): - output = bpy.data.texts[output_filename] - output.clear() - else: - output = bpy.data.texts.new(name=output_filename) - - header = '= Blender {} System Information =\n'.format(bpy.app.version_string) - lilies = '{}\n\n'.format(len(header)*'=') - firstlilies = '{}\n'.format(len(header)*'=') - output.write(firstlilies) - output.write(header) - output.write(lilies) - - # build info - output.write('\nBlender:\n') - output.write(lilies) - output.write('version {}, revision {}. {}\n'.format(bpy.app.version_string, bpy.app.build_revision, bpy.app.build_type)) - output.write('build date: {}, {}\n'.format(bpy.app.build_date, bpy.app.build_time)) - output.write('platform: {}\n'.format(bpy.app.build_platform)) - output.write('binary path: {}\n'.format(bpy.app.binary_path)) - output.write('build cflags: {}\n'.format(bpy.app.build_cflags)) - output.write('build cxxflags: {}\n'.format(bpy.app.build_cxxflags)) - output.write('build linkflags: {}\n'.format(bpy.app.build_linkflags)) - output.write('build system: {}\n'.format(bpy.app.build_system)) - - # python info - output.write('\nPython:\n') - output.write(lilies) - output.write('version: {}\n'.format(sys.version)) - output.write('paths:\n') - for p in sys.path: - output.write('\t{}\n'.format(p)) - - output.write('\nDirectories:\n') - output.write(lilies) - output.write('scripts: {}\n'.format(bpy.utils.script_paths())) - output.write('user scripts: {}\n'.format(bpy.utils.user_script_path())) - output.write('datafiles: {}\n'.format(bpy.utils.user_resource('DATAFILES'))) - output.write('config: {}\n'.format(bpy.utils.user_resource('CONFIG'))) - output.write('scripts : {}\n'.format(bpy.utils.user_resource('SCRIPTS'))) - output.write('autosave: {}\n'.format(bpy.utils.user_resource('AUTOSAVE'))) - output.write('tempdir: {}\n'.format(bpy.app.tempdir)) - - output.write('\nOpenGL\n') - output.write(lilies) - output.write('renderer:\t{}\n'.format(bgl.glGetString(bgl.GL_RENDERER))) - output.write('vendor:\t\t{}\n'.format(bgl.glGetString(bgl.GL_VENDOR))) - output.write('version:\t{}\n'.format(bgl.glGetString(bgl.GL_VERSION))) - output.write('extensions:\n') - - glext = bgl.glGetString(bgl.GL_EXTENSIONS) - glext = textWrap(glext, 70) - for l in glext: - output.write('\t\t{}\n'.format(l)) - - op.report({'INFO'}, "System information generated in 'system-info.txt'") + output_filename = "system-info.txt" + warnings = 0 + notices = 0 + + if output_filename in bpy.data.texts.keys(): + output = bpy.data.texts[output_filename] + output.clear() + else: + output = bpy.data.texts.new(name=output_filename) + + header = '= Blender {} System Information =\n'.format(bpy.app.version_string) + lilies = '{}\n\n'.format(len(header) * '=') + firstlilies = '{}\n'.format(len(header) * '=') + output.write(firstlilies) + output.write(header) + output.write(lilies) + + # build info + output.write('\nBlender:\n') + output.write(lilies) + output.write('version {}, revision {}. {}\n'.format(bpy.app.version_string, bpy.app.build_revision, bpy.app.build_type)) + output.write('build date: {}, {}\n'.format(bpy.app.build_date, bpy.app.build_time)) + output.write('platform: {}\n'.format(bpy.app.build_platform)) + output.write('binary path: {}\n'.format(bpy.app.binary_path)) + output.write('build cflags: {}\n'.format(bpy.app.build_cflags)) + output.write('build cxxflags: {}\n'.format(bpy.app.build_cxxflags)) + output.write('build linkflags: {}\n'.format(bpy.app.build_linkflags)) + output.write('build system: {}\n'.format(bpy.app.build_system)) + + # python info + output.write('\nPython:\n') + output.write(lilies) + output.write('version: {}\n'.format(sys.version)) + output.write('paths:\n') + for p in sys.path: + output.write('\t{}\n'.format(p)) + + output.write('\nDirectories:\n') + output.write(lilies) + output.write('scripts: {}\n'.format(bpy.utils.script_paths())) + output.write('user scripts: {}\n'.format(bpy.utils.user_script_path())) + output.write('datafiles: {}\n'.format(bpy.utils.user_resource('DATAFILES'))) + output.write('config: {}\n'.format(bpy.utils.user_resource('CONFIG'))) + output.write('scripts : {}\n'.format(bpy.utils.user_resource('SCRIPTS'))) + output.write('autosave: {}\n'.format(bpy.utils.user_resource('AUTOSAVE'))) + output.write('tempdir: {}\n'.format(bpy.app.tempdir)) + + output.write('\nOpenGL\n') + output.write(lilies) + output.write('renderer:\t{}\n'.format(bgl.glGetString(bgl.GL_RENDERER))) + output.write('vendor:\t\t{}\n'.format(bgl.glGetString(bgl.GL_VENDOR))) + output.write('version:\t{}\n'.format(bgl.glGetString(bgl.GL_VERSION))) + output.write('extensions:\n') + + glext = bgl.glGetString(bgl.GL_EXTENSIONS) + glext = textWrap(glext, 70) + for l in glext: + output.write('\t\t{}\n'.format(l)) + + op.report({'INFO'}, "System information generated in 'system-info.txt'") |