fix for error generating docs, write all files as utf-8

This commit is contained in:
Campbell Barton
2011-09-29 12:11:58 +00:00
parent a81b37e252
commit 081543fee8

View File

@@ -161,7 +161,7 @@ def range_str(val):
def example_extract_docstring(filepath): def example_extract_docstring(filepath):
file = open(filepath, 'r') file = open(filepath, "r", encoding="utf-8")
line = file.readline() line = file.readline()
line_no = 0 line_no = 0
text = [] text = []
@@ -360,7 +360,7 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
if module_all: if module_all:
module_dir = module_all module_dir = module_all
file = open(filepath, "w") file = open(filepath, "w", encoding="utf-8")
fw = file.write fw = file.write
@@ -510,7 +510,7 @@ def pycontext2sphinx(BASEPATH):
# Only use once. very irregular # Only use once. very irregular
filepath = os.path.join(BASEPATH, "bpy.context.rst") filepath = os.path.join(BASEPATH, "bpy.context.rst")
file = open(filepath, "w") file = open(filepath, "w", encoding="utf-8")
fw = file.write fw = file.write
fw("Context Access (bpy.context)\n") fw("Context Access (bpy.context)\n")
fw("============================\n\n") fw("============================\n\n")
@@ -698,7 +698,7 @@ def pyrna2sphinx(BASEPATH):
# return # return
filepath = os.path.join(BASEPATH, "bpy.types.%s.rst" % struct.identifier) filepath = os.path.join(BASEPATH, "bpy.types.%s.rst" % struct.identifier)
file = open(filepath, "w") file = open(filepath, "w", encoding="utf-8")
fw = file.write fw = file.write
base_id = getattr(struct.base, "identifier", "") base_id = getattr(struct.base, "identifier", "")
@@ -912,7 +912,7 @@ def pyrna2sphinx(BASEPATH):
def fake_bpy_type(class_value, class_name, descr_str, use_subclasses=True): def fake_bpy_type(class_value, class_name, descr_str, use_subclasses=True):
filepath = os.path.join(BASEPATH, "bpy.types.%s.rst" % class_name) filepath = os.path.join(BASEPATH, "bpy.types.%s.rst" % class_name)
file = open(filepath, "w") file = open(filepath, "w", encoding="utf-8")
fw = file.write fw = file.write
write_title(fw, class_name, "=") write_title(fw, class_name, "=")
@@ -963,7 +963,7 @@ def pyrna2sphinx(BASEPATH):
for op_module_name, ops_mod in op_modules.items(): for op_module_name, ops_mod in op_modules.items():
filepath = os.path.join(BASEPATH, "bpy.ops.%s.rst" % op_module_name) filepath = os.path.join(BASEPATH, "bpy.ops.%s.rst" % op_module_name)
file = open(filepath, "w") file = open(filepath, "w", encoding="utf-8")
fw = file.write fw = file.write
title = "%s Operators" % op_module_name.replace("_", " ").title() title = "%s Operators" % op_module_name.replace("_", " ").title()
@@ -1017,7 +1017,7 @@ def rna2sphinx(BASEPATH):
# conf.py - empty for now # conf.py - empty for now
filepath = os.path.join(BASEPATH, "conf.py") filepath = os.path.join(BASEPATH, "conf.py")
file = open(filepath, "w") file = open(filepath, "w", encoding="utf-8")
fw = file.write fw = file.write
version_string = ".".join(str(v) for v in bpy.app.version) version_string = ".".join(str(v) for v in bpy.app.version)
@@ -1053,7 +1053,7 @@ def rna2sphinx(BASEPATH):
# main page needed for sphinx (index.html) # main page needed for sphinx (index.html)
filepath = os.path.join(BASEPATH, "contents.rst") filepath = os.path.join(BASEPATH, "contents.rst")
file = open(filepath, "w") file = open(filepath, "w", encoding="utf-8")
fw = file.write fw = file.write
fw("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n") fw("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n")
@@ -1169,7 +1169,7 @@ def rna2sphinx(BASEPATH):
# internal modules # internal modules
if "bpy.ops" not in EXCLUDE_MODULES: if "bpy.ops" not in EXCLUDE_MODULES:
filepath = os.path.join(BASEPATH, "bpy.ops.rst") filepath = os.path.join(BASEPATH, "bpy.ops.rst")
file = open(filepath, "w") file = open(filepath, "w", encoding="utf-8")
fw = file.write fw = file.write
fw("Operators (bpy.ops)\n") fw("Operators (bpy.ops)\n")
fw("===================\n\n") fw("===================\n\n")
@@ -1181,7 +1181,7 @@ def rna2sphinx(BASEPATH):
if "bpy.types" not in EXCLUDE_MODULES: if "bpy.types" not in EXCLUDE_MODULES:
filepath = os.path.join(BASEPATH, "bpy.types.rst") filepath = os.path.join(BASEPATH, "bpy.types.rst")
file = open(filepath, "w") file = open(filepath, "w", encoding="utf-8")
fw = file.write fw = file.write
fw("Types (bpy.types)\n") fw("Types (bpy.types)\n")
fw("=================\n\n") fw("=================\n\n")
@@ -1194,7 +1194,7 @@ def rna2sphinx(BASEPATH):
# not actually a module, only write this file so we # not actually a module, only write this file so we
# can reference in the TOC # can reference in the TOC
filepath = os.path.join(BASEPATH, "bpy.data.rst") filepath = os.path.join(BASEPATH, "bpy.data.rst")
file = open(filepath, "w") file = open(filepath, "w", encoding="utf-8")
fw = file.write fw = file.write
fw("Data Access (bpy.data)\n") fw("Data Access (bpy.data)\n")
fw("======================\n\n") fw("======================\n\n")
@@ -1284,7 +1284,7 @@ def rna2sphinx(BASEPATH):
if 0: if 0:
filepath = os.path.join(BASEPATH, "bpy.rst") filepath = os.path.join(BASEPATH, "bpy.rst")
file = open(filepath, "w") file = open(filepath, "w", encoding="utf-8")
fw = file.write fw = file.write
fw("\n") fw("\n")