From bc15e0e2952bac0458ae61c97d4d8187e55cd1cc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 25 Feb 2011 16:19:50 +0000 Subject: [PATCH] add NDEBUG to scons release flags + some pep8 cleanup for examples. --- build_files/scons/config/aix4-config.py | 4 ++-- build_files/scons/config/darwin-config.py | 8 ++++---- build_files/scons/config/freebsd7-config.py | 4 ++-- build_files/scons/config/freebsd8-config.py | 4 ++-- build_files/scons/config/freebsd9-config.py | 4 ++-- build_files/scons/config/irix6-config.py | 4 ++-- build_files/scons/config/linux2-config.py | 4 ++-- build_files/scons/config/linuxcross-config.py | 4 ++-- build_files/scons/config/openbsd3-config.py | 4 ++-- build_files/scons/config/sunos5-config.py | 4 ++-- build_files/scons/config/win32-mingw-config.py | 4 ++-- doc/python_api/examples/bpy.ops.py | 2 +- doc/python_api/examples/bpy.props.3.py | 3 ++- doc/python_api/examples/bpy.types.Menu.1.py | 2 +- doc/python_api/examples/bpy.types.Menu.2.py | 1 + doc/python_api/examples/bpy.types.Menu.py | 2 +- doc/python_api/examples/bpy.types.Operator.5.py | 5 ++--- doc/python_api/examples/bpy.types.Panel.1.py | 1 - doc/python_api/examples/bpy.types.Panel.2.py | 1 + doc/python_api/sphinx_doc_gen.py | 2 +- 20 files changed, 34 insertions(+), 33 deletions(-) diff --git a/build_files/scons/config/aix4-config.py b/build_files/scons/config/aix4-config.py index 2e9a1dc0bf3..c3c28d27e6e 100644 --- a/build_files/scons/config/aix4-config.py +++ b/build_files/scons/config/aix4-config.py @@ -165,8 +165,8 @@ CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ] CPPFLAGS = [ '-DXP_UNIX', '-DWIN32', '-DFREE_WINDOWS' ] CXXFLAGS = ['-pipe', '-funsigned-char', '-fno-strict-aliasing' ] -REL_CFLAGS = [ '-O2' ] -REL_CCFLAGS = [ '-O2' ] +REL_CFLAGS = ['-DNDEBUG', '-O2' ] +REL_CCFLAGS = ['-DNDEBUG', '-O2' ] C_WARN = [ '-Wall' , '-Wno-char-subscripts', '-Wdeclaration-after-statement' ] CC_WARN = [ '-Wall' ] diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py index ff6029a7cb5..fb59eb69a2d 100644 --- a/build_files/scons/config/darwin-config.py +++ b/build_files/scons/config/darwin-config.py @@ -312,14 +312,14 @@ if USE_SDK==True: #Intel Macs are CoreDuo and Up if MACOSX_ARCHITECTURE == 'i386' or MACOSX_ARCHITECTURE == 'x86_64': - REL_CFLAGS = ['-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse'] - REL_CCFLAGS = ['-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse'] + REL_CFLAGS = ['-DNDEBUG', '-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse'] + REL_CCFLAGS = ['-DNDEBUG', '-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse'] else: CFLAGS = CFLAGS+['-fno-strict-aliasing'] CCFLAGS = CCFLAGS+['-fno-strict-aliasing'] CXXFLAGS = CXXFLAGS+['-fno-strict-aliasing'] - REL_CFLAGS = ['-O2'] - REL_CCFLAGS = ['-O2'] + REL_CFLAGS = ['-DNDEBUG', '-O2'] + REL_CCFLAGS = ['-DNDEBUG', '-O2'] # Intel 64bit Macs are Core2Duo and up if MACOSX_ARCHITECTURE == 'x86_64': diff --git a/build_files/scons/config/freebsd7-config.py b/build_files/scons/config/freebsd7-config.py index aa39b193fc7..387b4ed521a 100644 --- a/build_files/scons/config/freebsd7-config.py +++ b/build_files/scons/config/freebsd7-config.py @@ -180,8 +180,8 @@ CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFI if WITH_BF_FFMPEG: # libavutil needs UINT64_C() CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ] -REL_CFLAGS = ['-O2'] -REL_CCFLAGS = ['-O2'] +REL_CFLAGS = ['-DNDEBUG', '-O2'] +REL_CCFLAGS = ['-DNDEBUG', '-O2'] ##BF_DEPEND = True ## ##AR = ar diff --git a/build_files/scons/config/freebsd8-config.py b/build_files/scons/config/freebsd8-config.py index 8f22b32ba87..1ceeea9d823 100644 --- a/build_files/scons/config/freebsd8-config.py +++ b/build_files/scons/config/freebsd8-config.py @@ -180,8 +180,8 @@ CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFI if WITH_BF_FFMPEG: # libavutil needs UINT64_C() CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ] -REL_CFLAGS = ['-O2'] -REL_CCFLAGS = ['-O2'] +REL_CFLAGS = ['-DNDEBUG', '-O2'] +REL_CCFLAGS = ['-DNDEBUG', '-O2'] ##BF_DEPEND = True ## ##AR = ar diff --git a/build_files/scons/config/freebsd9-config.py b/build_files/scons/config/freebsd9-config.py index 87d979f33bb..4209ff4ab72 100644 --- a/build_files/scons/config/freebsd9-config.py +++ b/build_files/scons/config/freebsd9-config.py @@ -180,8 +180,8 @@ CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFI if WITH_BF_FFMPEG: # libavutil needs UINT64_C() CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ] -REL_CFLAGS = ['-O2'] -REL_CCFLAGS = ['-O2'] +REL_CFLAGS = ['-DNDEBUG', '-O2'] +REL_CCFLAGS = ['-DNDEBUG', '-O2'] ##BF_DEPEND = True ## ##AR = ar diff --git a/build_files/scons/config/irix6-config.py b/build_files/scons/config/irix6-config.py index f5680aa29a6..14dc04c4259 100644 --- a/build_files/scons/config/irix6-config.py +++ b/build_files/scons/config/irix6-config.py @@ -163,8 +163,8 @@ CCFLAGS = ['-pipe','-fPIC', '-n32'] CPPFLAGS = [] CXXFLAGS = ['-pipe','-fPIC', '-n32'] -REL_CFLAGS = ['-O2'] -REL_CCFLAGS = ['-O2'] +REL_CFLAGS = ['-DNDEBUG', '-O2'] +REL_CCFLAGS = ['-DNDEBUG', '-O2'] ##BF_DEPEND = 'true' ## ##AR = ar diff --git a/build_files/scons/config/linux2-config.py b/build_files/scons/config/linux2-config.py index 6a01d0236fc..b0054ea472e 100644 --- a/build_files/scons/config/linux2-config.py +++ b/build_files/scons/config/linux2-config.py @@ -198,8 +198,8 @@ CXXFLAGS += ['-fpermissive'] if WITH_BF_FFMPEG: # libavutil needs UINT64_C() CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ] -REL_CFLAGS = ['-O2'] -REL_CCFLAGS = ['-O2'] +REL_CFLAGS = ['-DNDEBUG', '-O2'] +REL_CCFLAGS = ['-DNDEBUG', '-O2'] ##BF_DEPEND = True ## ##AR = ar diff --git a/build_files/scons/config/linuxcross-config.py b/build_files/scons/config/linuxcross-config.py index 4302cb2b884..8ba82f795a5 100644 --- a/build_files/scons/config/linuxcross-config.py +++ b/build_files/scons/config/linuxcross-config.py @@ -176,8 +176,8 @@ CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ] CPPFLAGS = ['-DWIN32', '-DFREE_WINDOWS', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE'] CXXFLAGS = ['-pipe', '-funsigned-char', '-fno-strict-aliasing' ] -REL_CFLAGS = [ '-O2' ] -REL_CCFLAGS = [ '-O2' ] +REL_CFLAGS = ['-DNDEBUG', '-O2'] +REL_CCFLAGS = ['-DNDEBUG', '-O2'] C_WARN = ['-Wall', '-Wstrict-prototypes', '-Wno-char-subscripts', '-Wdeclaration-after-statement'] CC_WARN = [ '-Wall' ] diff --git a/build_files/scons/config/openbsd3-config.py b/build_files/scons/config/openbsd3-config.py index 4125e4c367c..4ecc0b158ca 100644 --- a/build_files/scons/config/openbsd3-config.py +++ b/build_files/scons/config/openbsd3-config.py @@ -122,8 +122,8 @@ CFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing'] CPPFLAGS = [] CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing'] CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing'] -REL_CFLAGS = ['-O2'] -REL_CCFLAGS = ['-O2'] +REL_CFLAGS = ['-DNDEBUG', '-O2'] +REL_CCFLAGS = ['-DNDEBUG', '-O2'] ##BF_DEPEND = True ## ##AR = ar diff --git a/build_files/scons/config/sunos5-config.py b/build_files/scons/config/sunos5-config.py index fd9dfecb705..9f998c168d0 100644 --- a/build_files/scons/config/sunos5-config.py +++ b/build_files/scons/config/sunos5-config.py @@ -138,8 +138,8 @@ CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing'] CPPFLAGS = ['-DSUN_OGL_NO_VERTEX_MACROS'] CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing'] -REL_CFLAGS = ['-O2'] -REL_CCFLAGS = ['-O2'] +REL_CFLAGS = ['-DNDEBUG', '-O2'] +REL_CCFLAGS = ['-DNDEBUG', '-O2'] ##BF_DEPEND = True ## ##AR = ar diff --git a/build_files/scons/config/win32-mingw-config.py b/build_files/scons/config/win32-mingw-config.py index 845110c0993..98ab63b5e73 100644 --- a/build_files/scons/config/win32-mingw-config.py +++ b/build_files/scons/config/win32-mingw-config.py @@ -166,8 +166,8 @@ CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ] CPPFLAGS = ['-DWIN32', '-DFREE_WINDOWS', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE'] CXXFLAGS = ['-pipe', '-mwindows', '-funsigned-char', '-fno-strict-aliasing' ] -REL_CFLAGS = [ '-O2' ] -REL_CCFLAGS = [ '-O2' ] +REL_CFLAGS = ['-DNDEBUG', '-O2'] +REL_CCFLAGS = ['-DNDEBUG', '-O2'] C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-prototypes'] diff --git a/doc/python_api/examples/bpy.ops.py b/doc/python_api/examples/bpy.ops.py index 487d6039327..20e8773652d 100644 --- a/doc/python_api/examples/bpy.ops.py +++ b/doc/python_api/examples/bpy.ops.py @@ -27,4 +27,4 @@ bpy.ops.mesh.subdivide(number_cuts=3, smoothness=0.5) # check poll() to avoid exception. if bpy.ops.object.mode_set.poll(): - bpy.ops.object.mode_set(mode='EDIT') + bpy.ops.object.mode_set(mode='EDIT') diff --git a/doc/python_api/examples/bpy.props.3.py b/doc/python_api/examples/bpy.props.3.py index e4964c366cf..e0b2cf419d2 100644 --- a/doc/python_api/examples/bpy.props.3.py +++ b/doc/python_api/examples/bpy.props.3.py @@ -8,6 +8,7 @@ Custom properties can be added to any subclass of an :class:`ID`, import bpy + # Assign a collection class SceneSettingItem(bpy.types.PropertyGroup): name = bpy.props.StringProperty(name="Test Prop", default="Unknown") @@ -30,4 +31,4 @@ my_item.name = "Eggs" my_item.value = 30 for my_item in bpy.context.scene.my_settings: - print(my_item.name, my_item.value) + print(my_item.name, my_item.value) diff --git a/doc/python_api/examples/bpy.types.Menu.1.py b/doc/python_api/examples/bpy.types.Menu.1.py index fa23e2dcfd3..92c961e93d2 100644 --- a/doc/python_api/examples/bpy.types.Menu.1.py +++ b/doc/python_api/examples/bpy.types.Menu.1.py @@ -12,7 +12,7 @@ class SubMenu(bpy.types.Menu): def draw(self, context): layout = self.layout - + layout.operator("object.select_all", text="Select/Deselect All") layout.operator("object.select_inverse", text="Inverse") layout.operator("object.select_random", text="Random") diff --git a/doc/python_api/examples/bpy.types.Menu.2.py b/doc/python_api/examples/bpy.types.Menu.2.py index 4579dd6c485..c87b10cb6e7 100644 --- a/doc/python_api/examples/bpy.types.Menu.2.py +++ b/doc/python_api/examples/bpy.types.Menu.2.py @@ -10,6 +10,7 @@ The function menu_draw acts like Menu.draw """ import bpy + def menu_draw(self, context): self.layout.operator("wm.save_homefile") diff --git a/doc/python_api/examples/bpy.types.Menu.py b/doc/python_api/examples/bpy.types.Menu.py index a6abba6bfad..3fbc0f6a8f0 100644 --- a/doc/python_api/examples/bpy.types.Menu.py +++ b/doc/python_api/examples/bpy.types.Menu.py @@ -20,7 +20,7 @@ class BasicMenu(bpy.types.Menu): def draw(self, context): layout = self.layout - + layout.operator("object.select_all", text="Select/Deselect All") layout.operator("object.select_inverse", text="Inverse") layout.operator("object.select_random", text="Random") diff --git a/doc/python_api/examples/bpy.types.Operator.5.py b/doc/python_api/examples/bpy.types.Operator.5.py index fd09120d3b0..7d1a98d4c34 100644 --- a/doc/python_api/examples/bpy.types.Operator.5.py +++ b/doc/python_api/examples/bpy.types.Operator.5.py @@ -25,7 +25,7 @@ class ModalOperator(bpy.types.Operator): def __init__(self): print("Start") - + def __del__(self): print("End") @@ -33,7 +33,7 @@ class ModalOperator(bpy.types.Operator): context.object.location.x = self.value / 100.0 def modal(self, context, event): - if event.type == 'MOUSEMOVE': # Apply + if event.type == 'MOUSEMOVE': # Apply self.value = event.mouse_x self.execute(context) elif event.type == 'LEFTMOUSE': # Confirm @@ -51,7 +51,6 @@ class ModalOperator(bpy.types.Operator): return {'RUNNING_MODAL'} - bpy.utils.register_class(ModalOperator) # test call diff --git a/doc/python_api/examples/bpy.types.Panel.1.py b/doc/python_api/examples/bpy.types.Panel.1.py index afe9493438e..ab32a043706 100644 --- a/doc/python_api/examples/bpy.types.Panel.1.py +++ b/doc/python_api/examples/bpy.types.Panel.1.py @@ -23,7 +23,6 @@ class ObjectSelectPanel(bpy.types.Panel): layout = self.layout obj = context.object layout.prop(obj, "select", text="") - def draw(self, context): layout = self.layout diff --git a/doc/python_api/examples/bpy.types.Panel.2.py b/doc/python_api/examples/bpy.types.Panel.2.py index 661d7cba766..a4b2f1fd338 100644 --- a/doc/python_api/examples/bpy.types.Panel.2.py +++ b/doc/python_api/examples/bpy.types.Panel.2.py @@ -6,6 +6,7 @@ A mix-in parent class can be used to share common properties and """ import bpy + class View3DPanel(): bl_space_type = 'VIEW_3D' bl_region_type = 'TOOLS' diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 8058ebeb137..e10d5c5cf9a 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -782,7 +782,7 @@ def pyrna2sphinx(BASEPATH): for op in ops.values(): op_modules.setdefault(op.module_name, []).append(op) del op - + for op_module_name, ops_mod in op_modules.items(): filepath = os.path.join(BASEPATH, "bpy.ops.%s.rst" % op_module_name) file = open(filepath, "w")