Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-06-27 08:50:08 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-06-27 08:50:08 +0400
commit69ff819a2eefa974ec4295eefc165d3f3548fffe (patch)
tree3f73c6f7cffe3b6e085a17996db9e41d695e7467 /doc
parente1ba5c8167e4f6ce71bb721525aedb11387f7726 (diff)
print the help message if running from python directly.
Diffstat (limited to 'doc')
-rw-r--r--doc/python_api/sphinx_doc_gen.py140
1 files changed, 72 insertions, 68 deletions
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index e96b4d363b4..0112007ca7f 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -29,15 +29,15 @@ For HTML generation
./blender.bin --background --python doc/python_api/sphinx_doc_gen.py
- This will generate python files in doc/python_api/sphinx-in/,
- assuming that ./blender.bin is or links to the blender executable
+ This will generate python files in doc/python_api/sphinx-in/
+ providing ./blender.bin is or links to the blender executable
- Generate html docs by running...
cd doc/python_api
sphinx-build sphinx-in sphinx-out
- assuming that you have sphinx 1.0.7 installed
+ This requires sphinx 1.0.7 to be installed.
For PDF generation
------------------
@@ -48,6 +48,15 @@ For PDF generation
make
'''
+# Check we're running in blender
+if __import__("sys").modules.get("bpy") is None:
+ print("\nError, this script must run from inside blender2.5")
+ print(script_help_msg)
+
+ import sys
+ sys.exit()
+
+
# Switch for quick testing
if 1:
# full build
@@ -1196,72 +1205,67 @@ def rna2sphinx(BASEPATH):
def main():
- import bpy
- if 'bpy' not in dir():
- print("\nError, this script must run from inside blender2.5")
- print(script_help_msg)
+ import shutil
+
+ script_dir = os.path.dirname(__file__)
+ path_in = os.path.join(script_dir, "sphinx-in")
+ path_out = os.path.join(script_dir, "sphinx-out")
+ path_examples = os.path.join(script_dir, "examples")
+ # only for partial updates
+ path_in_tmp = path_in + "-tmp"
+
+ if not os.path.exists(path_in):
+ os.mkdir(path_in)
+
+ for f in os.listdir(path_examples):
+ if f.endswith(".py"):
+ EXAMPLE_SET.add(os.path.splitext(f)[0])
+
+ # only for full updates
+ if _BPY_FULL_REBUILD:
+ shutil.rmtree(path_in, True)
+ shutil.rmtree(path_out, True)
else:
- import shutil
-
- script_dir = os.path.dirname(__file__)
- path_in = os.path.join(script_dir, "sphinx-in")
- path_out = os.path.join(script_dir, "sphinx-out")
- path_examples = os.path.join(script_dir, "examples")
- # only for partial updates
- path_in_tmp = path_in + "-tmp"
-
- if not os.path.exists(path_in):
- os.mkdir(path_in)
-
- for f in os.listdir(path_examples):
- if f.endswith(".py"):
- EXAMPLE_SET.add(os.path.splitext(f)[0])
-
- # only for full updates
- if _BPY_FULL_REBUILD:
- shutil.rmtree(path_in, True)
- shutil.rmtree(path_out, True)
- else:
- # write here, then move
- shutil.rmtree(path_in_tmp, True)
-
- rna2sphinx(path_in_tmp)
-
- if not _BPY_FULL_REBUILD:
- import filecmp
-
- # now move changed files from 'path_in_tmp' --> 'path_in'
- file_list_path_in = set(os.listdir(path_in))
- file_list_path_in_tmp = set(os.listdir(path_in_tmp))
-
- # remove deprecated files that have been removed.
- for f in sorted(file_list_path_in):
- if f not in file_list_path_in_tmp:
- print("\tdeprecated: %s" % f)
- os.remove(os.path.join(path_in, f))
-
- # freshen with new files.
- for f in sorted(file_list_path_in_tmp):
- f_from = os.path.join(path_in_tmp, f)
- f_to = os.path.join(path_in, f)
-
- do_copy = True
- if f in file_list_path_in:
- if filecmp.cmp(f_from, f_to):
- do_copy = False
-
- if do_copy:
- print("\tupdating: %s" % f)
- shutil.copy(f_from, f_to)
- '''else:
- print("\tkeeping: %s" % f) # eh, not that useful'''
-
- EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED
- if EXAMPLE_SET_UNUSED:
- print("\nUnused examples found in '%s'..." % path_examples)
- for f in EXAMPLE_SET_UNUSED:
- print(" %s.py" % f)
- print(" %d total\n" % len(EXAMPLE_SET_UNUSED))
+ # write here, then move
+ shutil.rmtree(path_in_tmp, True)
+
+ rna2sphinx(path_in_tmp)
+
+ if not _BPY_FULL_REBUILD:
+ import filecmp
+
+ # now move changed files from 'path_in_tmp' --> 'path_in'
+ file_list_path_in = set(os.listdir(path_in))
+ file_list_path_in_tmp = set(os.listdir(path_in_tmp))
+
+ # remove deprecated files that have been removed.
+ for f in sorted(file_list_path_in):
+ if f not in file_list_path_in_tmp:
+ print("\tdeprecated: %s" % f)
+ os.remove(os.path.join(path_in, f))
+
+ # freshen with new files.
+ for f in sorted(file_list_path_in_tmp):
+ f_from = os.path.join(path_in_tmp, f)
+ f_to = os.path.join(path_in, f)
+
+ do_copy = True
+ if f in file_list_path_in:
+ if filecmp.cmp(f_from, f_to):
+ do_copy = False
+
+ if do_copy:
+ print("\tupdating: %s" % f)
+ shutil.copy(f_from, f_to)
+ '''else:
+ print("\tkeeping: %s" % f) # eh, not that useful'''
+
+ EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED
+ if EXAMPLE_SET_UNUSED:
+ print("\nUnused examples found in '%s'..." % path_examples)
+ for f in EXAMPLE_SET_UNUSED:
+ print(" %s.py" % f)
+ print(" %d total\n" % len(EXAMPLE_SET_UNUSED))
import sys
sys.exit()