diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-12-23 08:04:03 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-12-23 08:04:03 +0300 |
commit | 9282d305bdc56522543129436db1e8a5d19cf39f (patch) | |
tree | b6d0cdcc7dd3f4113cf9e4f9813c40f44d29746e /build_files/cmake/cmake_qtcreator_project.py | |
parent | de724a258eda45d1fed2b2176006c3b2df8abea2 (diff) | |
parent | 646a96bf8edc211a06f3df652101c265ee166e8d (diff) |
Merge branch 'master' into texture_nodes_refactortexture_nodes_refactor
Conflicts:
source/blender/nodes/texture/nodes/node_texture_math.c
Diffstat (limited to 'build_files/cmake/cmake_qtcreator_project.py')
-rwxr-xr-x | build_files/cmake/cmake_qtcreator_project.py | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/build_files/cmake/cmake_qtcreator_project.py b/build_files/cmake/cmake_qtcreator_project.py index 346f5ea6a8e..59b8c7e5c4c 100755 --- a/build_files/cmake/cmake_qtcreator_project.py +++ b/build_files/cmake/cmake_qtcreator_project.py @@ -63,21 +63,21 @@ def create_qtc_project_main(): if SIMPLE_PROJECTFILE: # --- qtcreator specific, simple format PROJECT_NAME = "Blender" - f = open(os.path.join(PROJECT_DIR, "%s.files" % PROJECT_NAME), 'w') - f.write("\n".join(files_rel)) + with open(os.path.join(PROJECT_DIR, "%s.files" % PROJECT_NAME), 'w') as f: + f.write("\n".join(files_rel)) - f = open(os.path.join(PROJECT_DIR, "%s.includes" % PROJECT_NAME), 'w') - f.write("\n".join(sorted(list(set(os.path.dirname(f) - for f in files_rel if is_c_header(f)))))) + with open(os.path.join(PROJECT_DIR, "%s.includes" % PROJECT_NAME), 'w') as f: + f.write("\n".join(sorted(list(set(os.path.dirname(f) + for f in files_rel if is_c_header(f)))))) qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % PROJECT_NAME) - f = open(qtc_prj, 'w') - f.write("[General]\n") + with open(qtc_prj, 'w') as f: + f.write("[General]\n") qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % PROJECT_NAME) if not os.path.exists(qtc_cfg): - f = open(qtc_cfg, 'w') - f.write("// ADD PREDEFINED MACROS HERE!\n") + with open(qtc_cfg, 'w') as f: + f.write("// ADD PREDEFINED MACROS HERE!\n") else: includes, defines = cmake_advanced_info() @@ -96,29 +96,30 @@ def create_qtc_project_main(): PROJECT_NAME = project_name_get() FILE_NAME = PROJECT_NAME.lower() - f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') - f.write("\n".join(files_rel)) + with open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') as f: + f.write("\n".join(files_rel)) - f = open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w', encoding='utf-8') - f.write("\n".join(sorted(includes))) + with open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w', encoding='utf-8') as f: + f.write("\n".join(sorted(includes))) qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME) - f = open(qtc_prj, 'w') - f.write("[General]\n") + with open(qtc_prj, 'w') as f: + f.write("[General]\n") qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME) - f = open(qtc_cfg, 'w') - f.write("// ADD PREDEFINED MACROS TO %s_custom.config!\n" % FILE_NAME) - qtc_custom_cfg = os.path.join(PROJECT_DIR, "%s_custom.config" % FILE_NAME) - if os.path.exists(qtc_custom_cfg): - fc = open(qtc_custom_cfg, 'r') - f.write(fc.read()) - fc.close() - f.write("\n") - defines_final = [("#define %s %s" % (item[0], quote_define(item[1]))) for item in defines] - if sys.platform != "win32": - defines_final += cmake_compiler_defines() - f.write("\n".join(defines_final)) + with open(qtc_cfg, 'w') as f: + f.write("// ADD PREDEFINED MACROS TO %s_custom.config!\n" % FILE_NAME) + + qtc_custom_cfg = os.path.join(PROJECT_DIR, "%s_custom.config" % FILE_NAME) + if os.path.exists(qtc_custom_cfg): + with open(qtc_custom_cfg, 'r') as fc: + f.write(fc.read()) + f.write("\n") + + defines_final = [("#define %s %s" % (item[0], quote_define(item[1]))) for item in defines] + if sys.platform != "win32": + defines_final += cmake_compiler_defines() + f.write("\n".join(defines_final)) print("Blender project file written to: %r" % qtc_prj) # --- end @@ -137,17 +138,17 @@ def create_qtc_project_python(): PROJECT_NAME = project_name_get() + "_Python" FILE_NAME = PROJECT_NAME.lower() - f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') - f.write("\n".join(files_rel)) + with open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') as f: + f.write("\n".join(files_rel)) qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME) - f = open(qtc_prj, 'w') - f.write("[General]\n") + with open(qtc_prj, 'w') as f: + f.write("[General]\n") qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME) if not os.path.exists(qtc_cfg): - f = open(qtc_cfg, 'w') - f.write("// ADD PREDEFINED MACROS HERE!\n") + with open(qtc_cfg, 'w') as f: + f.write("// ADD PREDEFINED MACROS HERE!\n") print("Python project file written to: %r" % qtc_prj) |