From a3a3cafbc80256a691268862fb9906e838bc69dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 3 Jan 2025 22:38:38 +0100 Subject: [PATCH 1/4] SCons: Set explicit standards to C++98 and C11 Godot 1.0 was developed at a time where compilers defaulted to C++98. Also disable `-Wall` on debug builds, there are now hundreds of warnings from newer compilers that would need to be fixed. This would best be done by adding a new `warnings` SCons option, which would also affect non-debug builds, but I have no intention to fix warnings in the 1.0 branch, the goal here is just to get it to compile for archival and game preservation. (cherry picked from commit a68e96b8c2d88e01ff910b6e05631b50871ef0e0) --- SConstruct | 15 +++++++++++++++ platform/android/detect.py | 2 +- platform/flash/detect.py | 2 +- platform/iphone/detect.py | 6 +++--- platform/isim/detect.py | 4 ++-- platform/javascript/detect.py | 4 ++-- platform/nacl/detect.py | 2 +- platform/osx/detect.py | 2 +- platform/server/detect.py | 2 +- platform/windows/detect.py | 2 +- platform/x11/detect.py | 2 +- 11 files changed, 29 insertions(+), 14 deletions(-) diff --git a/SConstruct b/SConstruct index 11b35e0b4bb..58ad9117853 100644 --- a/SConstruct +++ b/SConstruct @@ -219,6 +219,21 @@ if selected_platform in platform_list: detect.configure(env) + # Set our C and C++ standard requirements. + # Prepending to make it possible to override. + # This MSVC "detection" is an extreme hack. + is_msvc = (os.name=="nt") and (os.getenv("VSINSTALLDIR")!=None or os.getenv("VCINSTALLDIR")!=None) and (selected_platform in ["windows", "winrt"]) + if (not is_msvc): + # Specifying GNU extensions support explicitly, which are supported by both GCC and Clang. + # We don't support C++17 so stick to earlier standards. + # Godot 1.0 definitely started as a C++98 codebase. + env.Prepend(CFLAGS=["-std=gnu11"]) + env.Prepend(CXXFLAGS=["-std=gnu++98"]) + # Disable these auto-enabled warnings which are treated as errors by modern compilers. + env.Prepend(CCFLAGS=["-Wno-error=implicit-function-declaration", "-Wno-error=incompatible-pointer-types"]) + else: + # MSVC doesn't support setting C++ to pre-C++14 standards, so do nothing and hope it works. + pass flag_list = platform_flags[selected_platform] for f in flag_list: diff --git a/platform/android/detect.py b/platform/android/detect.py index 5ef405f7b66..98637644698 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -150,7 +150,7 @@ def configure(env): elif (env["target"]=="debug"): - env.Append(CCFLAGS=['-D_DEBUG', '-g1', '-Wall', '-O0', '-DDEBUG_ENABLED']) + env.Append(CCFLAGS=['-D_DEBUG', '-g1', '-O0', '-DDEBUG_ENABLED']) env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']) if env["armv6"] == "no" and env['x86'] != 'yes': diff --git a/platform/flash/detect.py b/platform/flash/detect.py index 5507ce5177d..48be88738bc 100644 --- a/platform/flash/detect.py +++ b/platform/flash/detect.py @@ -98,7 +98,7 @@ def configure(env): elif (env["target"]=="debug"): - env.Append(CCFLAGS=['-D_DEBUG', '-g0', '-Wall', '-O0', '-DDEBUG_ENABLED']) + env.Append(CCFLAGS=['-D_DEBUG', '-g0', '-O0', '-DDEBUG_ENABLED']) env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']) env.Append(CPPFLAGS=['-DFLASH_ENABLED', '-DGLES1_ENABLED', '-DNO_FCNTL', '-DUNIX_ENABLED']) diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index fb57876a838..de30d9f369b 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -109,17 +109,17 @@ def configure(env): if (env["target"]=="release"): - env.Append(CCFLAGS=['-O3', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1','-Wall']) + env.Append(CCFLAGS=['-O3', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1']) env.Append(LINKFLAGS=['-O3', '-ffast-math']) elif env["target"] == "release_debug": - env.Append(CCFLAGS=['-Os', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED']) + env.Append(CCFLAGS=['-Os', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1','-DDEBUG_ENABLED']) env.Append(LINKFLAGS=['-Os', '-ffast-math']) env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED']) elif (env["target"]=="debug"): - env.Append(CCFLAGS=['-D_DEBUG', '-DDEBUG=1', '-gdwarf-2', '-Wall', '-O0', '-DDEBUG_ENABLED']) + env.Append(CCFLAGS=['-D_DEBUG', '-DDEBUG=1', '-gdwarf-2', '-O0', '-DDEBUG_ENABLED']) env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED']) elif (env["target"]=="profile"): diff --git a/platform/isim/detect.py b/platform/isim/detect.py index bd0fd2fea3b..a99816f03e2 100644 --- a/platform/isim/detect.py +++ b/platform/isim/detect.py @@ -51,7 +51,7 @@ def configure(env): env['AR'] = 'ar' import string - env['CCFLAGS'] = string.split('-arch i386 -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fasm-blocks -Wall -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -isysroot $ISIMSDK -mios-simulator-version-min=4.3 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\"') + env['CCFLAGS'] = string.split('-arch i386 -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fasm-blocks -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -isysroot $ISIMSDK -mios-simulator-version-min=4.3 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\"') env.Append(LINKFLAGS=['-arch', 'i386', '-mios-simulator-version-min=4.3', @@ -84,7 +84,7 @@ def configure(env): elif (env["target"]=="debug"): - env.Append(CCFLAGS=['-DDEBUG', '-D_DEBUG', '-gdwarf-2', '-Wall', '-O0', '-DDEBUG_ENABLED']) + env.Append(CCFLAGS=['-DDEBUG', '-D_DEBUG', '-gdwarf-2', '-O0', '-DDEBUG_ENABLED']) env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']) elif (env["target"]=="profile"): diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index 947a637fb99..eaebef0fcac 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -73,8 +73,8 @@ def configure(env): elif (env["target"]=="release_debug"): env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED']) elif (env["target"]=="debug"): - env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-O2', '-DDEBUG_ENABLED']) - #env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-g4', '-DDEBUG_ENABLED']) + env.Append(CCFLAGS=['-D_DEBUG', '-O2', '-DDEBUG_ENABLED']) + #env.Append(CCFLAGS=['-D_DEBUG', '-g4', '-DDEBUG_ENABLED']) env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']) env.Append(CPPFLAGS=["-fno-exceptions",'-DNO_SAFE_CAST','-fno-rtti']) diff --git a/platform/nacl/detect.py b/platform/nacl/detect.py index f8849cfd259..2acb59bb599 100644 --- a/platform/nacl/detect.py +++ b/platform/nacl/detect.py @@ -54,7 +54,7 @@ def configure(env): elif (env["target"]=="debug"): - env.Append(CCFLAGS=['-g', '-O0', '-Wall','-DDEBUG_ENABLED']) + env.Append(CCFLAGS=['-g', '-O0', '-DDEBUG_ENABLED']) elif (env["target"]=="profile"): diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 5703cbc5465..97c841ca9f0 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -51,7 +51,7 @@ def configure(env): elif (env["target"]=="debug"): - env.Append(CCFLAGS=['-g3', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED']) + env.Append(CCFLAGS=['-g3', '-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED']) if (env["freetype"]!="no"): diff --git a/platform/server/detect.py b/platform/server/detect.py index e2d64c65458..c43f0a716ef 100644 --- a/platform/server/detect.py +++ b/platform/server/detect.py @@ -69,7 +69,7 @@ def configure(env): elif (env["target"]=="debug"): - env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED']) + env.Append(CCFLAGS=['-g2', '-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED']) env.Append(CPPFLAGS=['-DSERVER_ENABLED','-DUNIX_ENABLED']) env.Append(LIBS=['pthread','z']) #TODO detect linux/BSD! diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 298fa3bc789..3c125c91411 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -325,7 +325,7 @@ def configure(env): elif (env["target"]=="debug"): - env.Append(CCFLAGS=['-g', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED']) + env.Append(CCFLAGS=['-g', '-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED']) if (env["freetype"]!="no"): env.Append(CCFLAGS=['-DFREETYPE_ENABLED']) diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 7fa1666c59d..63389960551 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -121,7 +121,7 @@ def configure(env): elif (env["target"]=="debug"): - env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED']) + env.Append(CCFLAGS=['-g2', '-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED']) env.ParseConfig('pkg-config x11 --cflags --libs') env.ParseConfig('pkg-config xinerama --cflags --libs') From 7ae44a055b2d723f5fcf1da2cd338c522b3fd051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 3 Jan 2025 22:43:12 +0100 Subject: [PATCH 2/4] Linux: Default to builtin openssl, freetype, and zlib Fix support for cross-compilation, and fix handling of builtin libraries, which would still attempt to link system libs and use system headers. Also patch out GLU includes from GLEW, we don't need it, so that removes another mandatory dependency. (cherry picked from commit abf6a0919b5d18a82248bb460331f0f4ba25ec2b) --- .../glew-remove-glu-dependency.patch | 22 +++++++++++++ drivers/gl_context/glew.h | 5 +++ platform/server/detect.py | 22 +++++++++++-- platform/x11/detect.py | 31 ++++++++++--------- 4 files changed, 63 insertions(+), 17 deletions(-) create mode 100644 drivers/gl_context/glew-remove-glu-dependency.patch diff --git a/drivers/gl_context/glew-remove-glu-dependency.patch b/drivers/gl_context/glew-remove-glu-dependency.patch new file mode 100644 index 00000000000..4ef9565a709 --- /dev/null +++ b/drivers/gl_context/glew-remove-glu-dependency.patch @@ -0,0 +1,22 @@ +diff --git a/drivers/gl_context/glew.h b/drivers/gl_context/glew.h +index 4eed47708f..5f937862bf 100644 +--- a/drivers/gl_context/glew.h ++++ b/drivers/gl_context/glew.h +@@ -1168,12 +1168,17 @@ GLAPI void GLAPIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei heigh + + /* ---------------------------------- GLU ---------------------------------- */ + ++// -- GODOT start -- ++// We don't use GLU, so remove a dependency. ++#if 0 + /* this is where we can safely include GLU */ + #if defined(__APPLE__) && defined(__MACH__) + #include + #else + #include + #endif ++#endif ++// -- GODOT end -- + + /* ----------------------------- GL_VERSION_1_2 ---------------------------- */ + diff --git a/drivers/gl_context/glew.h b/drivers/gl_context/glew.h index 4eed47708f4..5f937862bf3 100644 --- a/drivers/gl_context/glew.h +++ b/drivers/gl_context/glew.h @@ -1168,12 +1168,17 @@ GLAPI void GLAPIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei heigh /* ---------------------------------- GLU ---------------------------------- */ +// -- GODOT start -- +// We don't use GLU, so remove a dependency. +#if 0 /* this is where we can safely include GLU */ #if defined(__APPLE__) && defined(__MACH__) #include #else #include #endif +#endif +// -- GODOT end -- /* ----------------------------- GL_VERSION_1_2 ---------------------------- */ diff --git a/platform/server/detect.py b/platform/server/detect.py index c43f0a716ef..53e091d020b 100644 --- a/platform/server/detect.py +++ b/platform/server/detect.py @@ -27,8 +27,10 @@ def get_opts(): def get_flags(): return [ - ('builtin_zlib', 'no'), - ('theora','no'), #use builtin openssl + ('builtin_zlib', 'yes'), + ('openssl', 'builtin'), + ("freetype", "builtin"), + ('theora','no'), ] @@ -71,8 +73,22 @@ def configure(env): env.Append(CCFLAGS=['-g2', '-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED']) + + if (env["openssl"]=="yes"): + env.ParseConfig('pkg-config openssl --cflags --libs') + + if (env["freetype"]!="no"): + env.Append(CCFLAGS=['-DFREETYPE_ENABLED']) + if (env["freetype"]=="builtin"): + env.Append(CPPPATH=['#tools/freetype']) + env.Append(CPPPATH=['#tools/freetype/freetype/include']) + else: + env.ParseConfig('pkg-config freetype2 --cflags --libs') + env.Append(CPPFLAGS=['-DSERVER_ENABLED','-DUNIX_ENABLED']) - env.Append(LIBS=['pthread','z']) #TODO detect linux/BSD! + env.Append(LIBS=['pthread']) #TODO detect linux/BSD! + if (env["builtin_zlib"]=="no"): + env.Append(LIBS=['z']) if (env["CXX"]=="clang++"): env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 63389960551..9e5c5e162c9 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -29,11 +29,6 @@ def can_build(): print("X11 not found.. x11 disabled.") return False - ssl_error=os.system("pkg-config openssl --modversion > /dev/null ") - if (ssl_error): - print("OpenSSL not found.. x11 disabled.") - return False - x11_error=os.system("pkg-config xcursor --modversion > /dev/null ") if (x11_error): print("xcursor not found.. x11 disabled.") @@ -61,8 +56,9 @@ def get_opts(): def get_flags(): return [ - ('builtin_zlib', 'no'), - ("openssl", "yes"), + ('builtin_zlib', 'yes'), + ("openssl", "builtin"), + ("freetype", "builtin"), ("theora","no"), ] @@ -126,13 +122,18 @@ def configure(env): env.ParseConfig('pkg-config x11 --cflags --libs') env.ParseConfig('pkg-config xinerama --cflags --libs') env.ParseConfig('pkg-config xcursor --cflags --libs') - env.ParseConfig('pkg-config openssl --cflags --libs') + if (env["openssl"]=="yes"): + env.ParseConfig('pkg-config openssl --cflags --libs') - env.ParseConfig('pkg-config freetype2 --cflags --libs') - env.Append(CCFLAGS=['-DFREETYPE_ENABLED']) + if (env["freetype"]!="no"): + env.Append(CCFLAGS=['-DFREETYPE_ENABLED']) + if (env["freetype"]=="builtin"): + env.Append(CPPPATH=['#tools/freetype']) + env.Append(CPPPATH=['#tools/freetype/freetype/include']) + else: + env.ParseConfig('pkg-config freetype2 --cflags --libs') - env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED']) env.Append(CPPFLAGS=["-DALSA_ENABLED"]) @@ -145,17 +146,19 @@ def configure(env): print("PulseAudio development libraries not found, disabling driver") env.Append(CPPFLAGS=['-DX11_ENABLED','-DUNIX_ENABLED','-DGLES2_ENABLED','-DGLES_OVER_GL']) - env.Append(LIBS=['GL', 'GLU', 'pthread','asound','z']) #TODO detect linux/BSD! + env.Append(LIBS=['GL', 'pthread', 'asound']) #TODO detect linux/BSD! + if (env["builtin_zlib"]=="no"): + env.Append(LIBS=['z']) #env.Append(CPPFLAGS=['-DMPC_FIXED_POINT']) #host compiler is default.. if (is64 and env["bits"]=="32"): env.Append(CPPFLAGS=['-m32']) - env.Append(LINKFLAGS=['-m32','-L/usr/lib/i386-linux-gnu']) + env.Append(LINKFLAGS=['-m32']) elif (not is64 and env["bits"]=="64"): env.Append(CPPFLAGS=['-m64']) - env.Append(LINKFLAGS=['-m64','-L/usr/lib/i686-linux-gnu']) + env.Append(LINKFLAGS=['-m64']) import methods From 8ee6e3848ef7de307eeed916557c9b2d38def7e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 3 Jan 2025 22:43:51 +0100 Subject: [PATCH 3/4] OSX: Add support for building with osxcross (cherry picked from commit eb111c1d39119c92baed00dd69ec6a85820102bd) --- platform/osx/detect.py | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 97c841ca9f0..fbbdfaf385d 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -11,16 +11,16 @@ def get_name(): def can_build(): - if (sys.platform != "darwin"): - return False + if (sys.platform == "darwin" or ("OSXCROSS_ROOT" in os.environ)): + return True - return True # osx enabled + return False def get_opts(): return [ ('force_64_bits','Force 64 bits binary','no'), - + ('osxcross_sdk', 'OSXCross SDK version', 'darwin14'), ] def get_flags(): @@ -59,12 +59,25 @@ def configure(env): env.Append(CPPPATH=['#tools/freetype']) env.Append(CPPPATH=['#tools/freetype/freetype/include']) - if (env["bits"]=="64"): - env.Append(CCFLAGS=['-arch', 'x86_64']) - env.Append(LINKFLAGS=['-arch', 'x86_64']) + if ("OSXCROSS_ROOT" not in os.environ): + # regular native build + if (env["bits"]=="64"): + env.Append(CCFLAGS=['-arch', 'x86_64']) + env.Append(LINKFLAGS=['-arch', 'x86_64']) + else: + env.Append(CCFLAGS=['-arch', 'i386']) + env.Append(LINKFLAGS=['-arch', 'i386']) else: - env.Append(CCFLAGS=['-arch', 'i386']) - env.Append(LINKFLAGS=['-arch', 'i386']) + # osxcross build + root = os.environ.get("OSXCROSS_ROOT", 0) + arch = "i686" if env["bits"]=="32" else "x86_64" + basecmd = root + "/target/bin/" + arch + "-apple-" + env["osxcross_sdk"] + "-" + + env['CC'] = basecmd + "cc" + env['CXX'] = basecmd + "c++" + env['AR'] = basecmd + "ar" + env['RANLIB'] = basecmd + "ranlib" + env['AS'] = basecmd + "as" # env.Append(CPPPATH=['#platform/osx/include/freetype2', '#platform/osx/include']) # env.Append(LIBPATH=['#platform/osx/lib']) From c47810c33b101907efb2ad53de8c1b4465b271e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 3 Jan 2025 22:44:20 +0100 Subject: [PATCH 4/4] SCons: Ensure written files are properly flushed/closed Also add `core/method_bind_ext.inc` to `.gitignore`. (cherry picked from commit ad2fb7d93bf0fc0d1266dc7267a074f2293d48d0) --- methods.py | 6 +++++- platform/android/SCsub | 1 + tools/docdump/doc_merge.py | 2 +- tools/docdump/makedoku.py | 10 +++++----- tools/docdump/makemd.py | 2 ++ tools/editor/SCsub | 1 + tools/export/blender25/io_scene_dae/export_dae.py | 1 + tools/glwrapper/makewrapper.py | 6 +++--- 8 files changed, 19 insertions(+), 10 deletions(-) diff --git a/methods.py b/methods.py index 9608b1b61d7..f9e334a1d33 100755 --- a/methods.py +++ b/methods.py @@ -42,6 +42,7 @@ def build_shader_header( target, source, env ): line=fs.readline() fd.write(";\n") + fd.close() return 0 @@ -1098,6 +1099,7 @@ def update_version(): f.write("#define VERSION_MINOR "+str(version.minor)+"\n") f.write("#define VERSION_REVISION "+str(rev)+"\n") f.write("#define VERSION_STATUS "+str(version.status)+"\n") + f.close() def parse_cg_file(fname, uniforms, sizes, conditionals): @@ -1167,8 +1169,8 @@ def build_cg_shader(sname): fd.write('\t\tVP_%s,\n' % vp_uniforms[i].upper()) fd.write("\t};\n"); + fd.close() - import glob def detect_modules(): @@ -1219,6 +1221,7 @@ void unregister_module_types() { f=open("modules/register_module_types.cpp","wb") f.write(modules_cpp) + f.close() return module_list @@ -1323,6 +1326,7 @@ def save_active_platforms(apnames,ap): wf = x+"/logo.h" logow = open(wf,"wb") logow.write(str) + logow.close() def colored(sys,env): diff --git a/platform/android/SCsub b/platform/android/SCsub index 6feeb8b3655..bdafa020f61 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -59,6 +59,7 @@ manifest = manifest.replace("$$ADD_APPLICATION_CHUNKS$$",env.android_manifest_ch manifest = manifest.replace("$$ADD_PERMISSION_CHUNKS$$",env.android_permission_chunk) manifest = manifest.replace("$$ADD_APPATTRIBUTE_CHUNKS$$",env.android_appattributes_chunk) pp_baseout.write( manifest ) +pp_baseout.close() for x in env.android_source_files: diff --git a/tools/docdump/doc_merge.py b/tools/docdump/doc_merge.py index 872f38ed870..a90588b4d04 100644 --- a/tools/docdump/doc_merge.py +++ b/tools/docdump/doc_merge.py @@ -205,4 +205,4 @@ for c in list(new_doc): write_class(c) write_string(f,'\n') - +f.close() diff --git a/tools/docdump/makedoku.py b/tools/docdump/makedoku.py index e8207715fe7..36a7cbb98f8 100644 --- a/tools/docdump/makedoku.py +++ b/tools/docdump/makedoku.py @@ -75,8 +75,9 @@ def make_class_list(class_list,columns): s+="\n" f.write(s) - - + f.close() + + def dokuize_text(txt): return txt @@ -220,7 +221,7 @@ def make_method(f,name,m,declare,event=False): s+=" "+m.attrib["qualifiers"] f.write(s+"\n") - + f.close() def make_doku_class(node): @@ -302,8 +303,7 @@ def make_doku_class(node): f.write(dokuize_text(d.text.strip())) f.write("\n") - - + f.close() """ diff --git a/tools/docdump/makemd.py b/tools/docdump/makemd.py index f85d145d5e5..5ab345d6d23 100644 --- a/tools/docdump/makemd.py +++ b/tools/docdump/makemd.py @@ -85,6 +85,7 @@ def make_class_list(class_list, columns): s += '\n' f.write(s) + f.close() def dokuize_text(txt): @@ -317,6 +318,7 @@ def make_doku_class(node): f.write('\n') f.write(dokuize_text(d.text.strip())) f.write('\n') + f.close() for file in input_list: diff --git a/tools/editor/SCsub b/tools/editor/SCsub index 73ec5301774..39719540559 100644 --- a/tools/editor/SCsub +++ b/tools/editor/SCsub @@ -23,6 +23,7 @@ def make_doc_header(target,source,env): g.write(str(ord(buf[i]))+",\n") g.write("};\n") g.write("#endif") + g.close() diff --git a/tools/export/blender25/io_scene_dae/export_dae.py b/tools/export/blender25/io_scene_dae/export_dae.py index 492a737e23e..58821da5dd6 100644 --- a/tools/export/blender25/io_scene_dae/export_dae.py +++ b/tools/export/blender25/io_scene_dae/export_dae.py @@ -1656,6 +1656,7 @@ class DaeExporter: f.write(bytes('\t\n',"UTF-8")) f.write(bytes('\n',"UTF-8")) f.write(bytes('\n',"UTF-8")) + f.close() return True def __init__(self,path,kwargs,operator): diff --git a/tools/glwrapper/makewrapper.py b/tools/glwrapper/makewrapper.py index cde976d5f93..537487275a1 100644 --- a/tools/glwrapper/makewrapper.py +++ b/tools/glwrapper/makewrapper.py @@ -157,6 +157,7 @@ f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) );\n") f.write("#ifdef __cplusplus\n}\n#endif\n") f.write("#endif\n\n") +f.close() f=open("glwrapper.c","w") @@ -177,8 +178,7 @@ for x in functions: f.write("\n\n") f.write("}\n") f.write("\n\n") - - +f.close() - \ No newline at end of file +