Fix project-file generators (didn't close files)
This commit is contained in:
@@ -125,6 +125,8 @@ def create_nb_project_main():
|
|||||||
f.write(' </configuration>\n')
|
f.write(' </configuration>\n')
|
||||||
f.write('</project>\n')
|
f.write('</project>\n')
|
||||||
|
|
||||||
|
f.close()
|
||||||
|
|
||||||
f = open(join(PROJECT_DIR_NB, "configurations.xml"), 'w')
|
f = open(join(PROJECT_DIR_NB, "configurations.xml"), 'w')
|
||||||
|
|
||||||
f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||||
@@ -243,6 +245,8 @@ def create_nb_project_main():
|
|||||||
|
|
||||||
f.write('</configurationDescriptor>\n')
|
f.write('</configurationDescriptor>\n')
|
||||||
|
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
create_nb_project_main()
|
create_nb_project_main()
|
||||||
|
|||||||
@@ -63,21 +63,21 @@ def create_qtc_project_main():
|
|||||||
if SIMPLE_PROJECTFILE:
|
if SIMPLE_PROJECTFILE:
|
||||||
# --- qtcreator specific, simple format
|
# --- qtcreator specific, simple format
|
||||||
PROJECT_NAME = "Blender"
|
PROJECT_NAME = "Blender"
|
||||||
f = open(os.path.join(PROJECT_DIR, "%s.files" % PROJECT_NAME), 'w')
|
with open(os.path.join(PROJECT_DIR, "%s.files" % PROJECT_NAME), 'w') as f:
|
||||||
f.write("\n".join(files_rel))
|
f.write("\n".join(files_rel))
|
||||||
|
|
||||||
f = open(os.path.join(PROJECT_DIR, "%s.includes" % PROJECT_NAME), 'w')
|
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)
|
f.write("\n".join(sorted(list(set(os.path.dirname(f)
|
||||||
for f in files_rel if is_c_header(f))))))
|
for f in files_rel if is_c_header(f))))))
|
||||||
|
|
||||||
qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % PROJECT_NAME)
|
qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % PROJECT_NAME)
|
||||||
f = open(qtc_prj, 'w')
|
with open(qtc_prj, 'w') as f:
|
||||||
f.write("[General]\n")
|
f.write("[General]\n")
|
||||||
|
|
||||||
qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % PROJECT_NAME)
|
qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % PROJECT_NAME)
|
||||||
if not os.path.exists(qtc_cfg):
|
if not os.path.exists(qtc_cfg):
|
||||||
f = open(qtc_cfg, 'w')
|
with open(qtc_cfg, 'w') as f:
|
||||||
f.write("// ADD PREDEFINED MACROS HERE!\n")
|
f.write("// ADD PREDEFINED MACROS HERE!\n")
|
||||||
else:
|
else:
|
||||||
includes, defines = cmake_advanced_info()
|
includes, defines = cmake_advanced_info()
|
||||||
|
|
||||||
@@ -96,29 +96,30 @@ def create_qtc_project_main():
|
|||||||
PROJECT_NAME = project_name_get()
|
PROJECT_NAME = project_name_get()
|
||||||
|
|
||||||
FILE_NAME = PROJECT_NAME.lower()
|
FILE_NAME = PROJECT_NAME.lower()
|
||||||
f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w')
|
with open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') as f:
|
||||||
f.write("\n".join(files_rel))
|
f.write("\n".join(files_rel))
|
||||||
|
|
||||||
f = open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w', encoding='utf-8')
|
with open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w', encoding='utf-8') as f:
|
||||||
f.write("\n".join(sorted(includes)))
|
f.write("\n".join(sorted(includes)))
|
||||||
|
|
||||||
qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME)
|
qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME)
|
||||||
f = open(qtc_prj, 'w')
|
with open(qtc_prj, 'w') as f:
|
||||||
f.write("[General]\n")
|
f.write("[General]\n")
|
||||||
|
|
||||||
qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME)
|
qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME)
|
||||||
f = open(qtc_cfg, 'w')
|
with open(qtc_cfg, 'w') as f:
|
||||||
f.write("// ADD PREDEFINED MACROS TO %s_custom.config!\n" % FILE_NAME)
|
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):
|
qtc_custom_cfg = os.path.join(PROJECT_DIR, "%s_custom.config" % FILE_NAME)
|
||||||
fc = open(qtc_custom_cfg, 'r')
|
if os.path.exists(qtc_custom_cfg):
|
||||||
f.write(fc.read())
|
with open(qtc_custom_cfg, 'r') as fc:
|
||||||
fc.close()
|
f.write(fc.read())
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
defines_final = [("#define %s %s" % (item[0], quote_define(item[1]))) for item in defines]
|
|
||||||
if sys.platform != "win32":
|
defines_final = [("#define %s %s" % (item[0], quote_define(item[1]))) for item in defines]
|
||||||
defines_final += cmake_compiler_defines()
|
if sys.platform != "win32":
|
||||||
f.write("\n".join(defines_final))
|
defines_final += cmake_compiler_defines()
|
||||||
|
f.write("\n".join(defines_final))
|
||||||
|
|
||||||
print("Blender project file written to: %r" % qtc_prj)
|
print("Blender project file written to: %r" % qtc_prj)
|
||||||
# --- end
|
# --- end
|
||||||
@@ -137,17 +138,17 @@ def create_qtc_project_python():
|
|||||||
PROJECT_NAME = project_name_get() + "_Python"
|
PROJECT_NAME = project_name_get() + "_Python"
|
||||||
|
|
||||||
FILE_NAME = PROJECT_NAME.lower()
|
FILE_NAME = PROJECT_NAME.lower()
|
||||||
f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w')
|
with open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') as f:
|
||||||
f.write("\n".join(files_rel))
|
f.write("\n".join(files_rel))
|
||||||
|
|
||||||
qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME)
|
qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME)
|
||||||
f = open(qtc_prj, 'w')
|
with open(qtc_prj, 'w') as f:
|
||||||
f.write("[General]\n")
|
f.write("[General]\n")
|
||||||
|
|
||||||
qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME)
|
qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME)
|
||||||
if not os.path.exists(qtc_cfg):
|
if not os.path.exists(qtc_cfg):
|
||||||
f = open(qtc_cfg, 'w')
|
with open(qtc_cfg, 'w') as f:
|
||||||
f.write("// ADD PREDEFINED MACROS HERE!\n")
|
f.write("// ADD PREDEFINED MACROS HERE!\n")
|
||||||
|
|
||||||
print("Python project file written to: %r" % qtc_prj)
|
print("Python project file written to: %r" % qtc_prj)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user