428
438
py_c_func2sphinx("", fw, module_name, None, attribute, value, is_class=False)
429
439
elif value_type == type:
430
440
classes.append((attribute, value))
441
elif issubclass(value_type, types.ModuleType):
442
submodules.append((attribute, value))
431
443
elif value_type in (bool, int, float, str, tuple):
432
444
# constant, not much fun we can do here except to list it.
433
445
# TODO, figure out some way to document these!
435
447
write_indented_lines(" ", fw, "constant value %s" % repr(value), False)
438
print("\tnot documenting %s.%s" % (module_name, attribute))
450
print("\tnot documenting %s.%s of %r type" % (module_name, attribute, value_type.__name__))
441
453
attribute_set.add(attribute)
442
454
# TODO, more types...
456
# TODO, bpy_extras does this already, mathutils not.
465
for attribute, submod in submodules:
466
fw("* :mod:`%s.%s`\n" % (module_name, attribute))
444
470
# write collected classes now
445
471
for (type_name, value) in classes:
446
472
# May need to be its own function
1150
1179
import mathutils.geometry as module
1151
1180
pymodule2sphinx(BASEPATH, "mathutils.geometry", module, "Geometry Utilities")
1153
if "mathutils.geometry" not in EXCLUDE_MODULES:
1182
if "blf" not in EXCLUDE_MODULES:
1154
1183
import blf as module
1155
1184
pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing")
1158
#import bgl as module
1159
#pymodule2sphinx(BASEPATH, "bgl", module, "Blender OpenGl wrapper")
1186
if "bgl" not in EXCLUDE_MODULES:
1187
#import bgl as module
1188
#pymodule2sphinx(BASEPATH, "bgl", module, "Blender OpenGl wrapper")
1191
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bgl.rst"), BASEPATH)
1162
1193
if "aud" not in EXCLUDE_MODULES:
1163
1194
import aud as module
1171
1202
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.types.rst"), BASEPATH)
1172
1203
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.logic.rst"), BASEPATH)
1173
1204
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.render.rst"), BASEPATH)
1205
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.texture.rst"), BASEPATH)
1174
1206
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.events.rst"), BASEPATH)
1207
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.constraints.rst"), BASEPATH)
1176
1209
shutil.copy2(os.path.join(BASEPATH, "..", "rst", "change_log.rst"), BASEPATH)
1200
if 'bpy' not in dir():
1201
print("\nError, this script must run from inside blender2.5")
1202
print(script_help_msg)
1234
script_dir = os.path.dirname(__file__)
1235
path_in = os.path.join(script_dir, "sphinx-in")
1236
path_out = os.path.join(script_dir, "sphinx-out")
1237
path_examples = os.path.join(script_dir, "examples")
1238
# only for partial updates
1239
path_in_tmp = path_in + "-tmp"
1241
if not os.path.exists(path_in):
1244
for f in os.listdir(path_examples):
1245
if f.endswith(".py"):
1246
EXAMPLE_SET.add(os.path.splitext(f)[0])
1248
# only for full updates
1249
if _BPY_FULL_REBUILD:
1250
shutil.rmtree(path_in, True)
1251
shutil.rmtree(path_out, True)
1206
script_dir = os.path.dirname(__file__)
1207
path_in = os.path.join(script_dir, "sphinx-in")
1208
path_out = os.path.join(script_dir, "sphinx-out")
1209
path_examples = os.path.join(script_dir, "examples")
1210
# only for partial updates
1211
path_in_tmp = path_in + "-tmp"
1213
if not os.path.exists(path_in):
1216
for f in os.listdir(path_examples):
1217
if f.endswith(".py"):
1218
EXAMPLE_SET.add(os.path.splitext(f)[0])
1220
# only for full updates
1221
if _BPY_FULL_REBUILD:
1222
shutil.rmtree(path_in, True)
1223
shutil.rmtree(path_out, True)
1225
# write here, then move
1226
shutil.rmtree(path_in_tmp, True)
1228
rna2sphinx(path_in_tmp)
1230
if not _BPY_FULL_REBUILD:
1233
# now move changed files from 'path_in_tmp' --> 'path_in'
1234
file_list_path_in = set(os.listdir(path_in))
1235
file_list_path_in_tmp = set(os.listdir(path_in_tmp))
1237
# remove deprecated files that have been removed.
1238
for f in sorted(file_list_path_in):
1239
if f not in file_list_path_in_tmp:
1240
print("\tdeprecated: %s" % f)
1241
os.remove(os.path.join(path_in, f))
1243
# freshen with new files.
1244
for f in sorted(file_list_path_in_tmp):
1245
f_from = os.path.join(path_in_tmp, f)
1246
f_to = os.path.join(path_in, f)
1249
if f in file_list_path_in:
1250
if filecmp.cmp(f_from, f_to):
1254
print("\tupdating: %s" % f)
1255
shutil.copy(f_from, f_to)
1257
print("\tkeeping: %s" % f) # eh, not that useful'''
1259
EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED
1260
if EXAMPLE_SET_UNUSED:
1261
print("\nUnused examples found in '%s'..." % path_examples)
1262
for f in EXAMPLE_SET_UNUSED:
1264
print(" %d total\n" % len(EXAMPLE_SET_UNUSED))
1253
# write here, then move
1254
shutil.rmtree(path_in_tmp, True)
1256
rna2sphinx(path_in_tmp)
1258
if not _BPY_FULL_REBUILD:
1261
# now move changed files from 'path_in_tmp' --> 'path_in'
1262
file_list_path_in = set(os.listdir(path_in))
1263
file_list_path_in_tmp = set(os.listdir(path_in_tmp))
1265
# remove deprecated files that have been removed.
1266
for f in sorted(file_list_path_in):
1267
if f not in file_list_path_in_tmp:
1268
print("\tdeprecated: %s" % f)
1269
os.remove(os.path.join(path_in, f))
1271
# freshen with new files.
1272
for f in sorted(file_list_path_in_tmp):
1273
f_from = os.path.join(path_in_tmp, f)
1274
f_to = os.path.join(path_in, f)
1277
if f in file_list_path_in:
1278
if filecmp.cmp(f_from, f_to):
1282
print("\tupdating: %s" % f)
1283
shutil.copy(f_from, f_to)
1285
print("\tkeeping: %s" % f) # eh, not that useful'''
1287
EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED
1288
if EXAMPLE_SET_UNUSED:
1289
print("\nUnused examples found in '%s'..." % path_examples)
1290
for f in EXAMPLE_SET_UNUSED:
1292
print(" %d total\n" % len(EXAMPLE_SET_UNUSED))