[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44923] trunk/blender/doc/python_api/ sphinx_doc_gen.py: == Python API docs ==

Luca Bonavita mindrones at gmail.com
Fri Mar 16 15:49:20 CET 2012


Revision: 44923
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44923
Author:   mindrones
Date:     2012-03-16 14:49:16 +0000 (Fri, 16 Mar 2012)
Log Message:
-----------
== Python API docs ==

Small fixes (thanks Terry Wallwork for reporting)
- adding logger filehandler in main () so that ARGS.output_dir exists, otherwise we get an IOError
- the zip was not including files in a container directory

Modified Paths:
--------------
    trunk/blender/doc/python_api/sphinx_doc_gen.py

Modified: trunk/blender/doc/python_api/sphinx_doc_gen.py
===================================================================
--- trunk/blender/doc/python_api/sphinx_doc_gen.py	2012-03-16 14:06:43 UTC (rev 44922)
+++ trunk/blender/doc/python_api/sphinx_doc_gen.py	2012-03-16 14:49:16 UTC (rev 44923)
@@ -209,17 +209,6 @@
 BPY_LOGGER = logging.getLogger('bpy')
 BPY_LOGGER.setLevel(logging.DEBUG)
 
-if ARGS.log:
-    BPY_LOGFILE = os.path.join(ARGS.output_dir, ".bpy.log")
-    bpy_logfilehandler = logging.FileHandler(BPY_LOGFILE, mode="w")
-    bpy_logfilehandler.setLevel(logging.DEBUG)
-    BPY_LOGGER.addHandler(bpy_logfilehandler)
-
-    # using a FileHandler seems to disable the stdout, so we add a StreamHandler
-    bpy_log_stdout_handler = logging.StreamHandler(stream=sys.stdout)
-    bpy_log_stdout_handler.setLevel(logging.DEBUG)
-    BPY_LOGGER.addHandler(bpy_log_stdout_handler)
-
 """
 # for quick rebuilds
 rm -rf /b/doc/python_api/sphinx-* && \
@@ -1733,6 +1722,18 @@
         if not os.path.exists(dir_path):
             os.mkdir(dir_path)
 
+    # eventually, log in files
+    if ARGS.log:
+        bpy_logfile = os.path.join(ARGS.output_dir, ".bpy.log")
+        bpy_logfilehandler = logging.FileHandler(bpy_logfile, mode="w")
+        bpy_logfilehandler.setLevel(logging.DEBUG)
+        BPY_LOGGER.addHandler(bpy_logfilehandler)
+    
+        # using a FileHandler seems to disable the stdout, so we add a StreamHandler
+        bpy_log_stdout_handler = logging.StreamHandler(stream=sys.stdout)
+        bpy_log_stdout_handler.setLevel(logging.DEBUG)
+        BPY_LOGGER.addHandler(bpy_log_stdout_handler)
+
     # in case of out-of-source build, copy the needed dirs
     if ARGS.output_dir != SCRIPT_DIR:
         # examples dir
@@ -1820,7 +1821,9 @@
 
             # zip REFERENCE_PATH
             basename = os.path.join(ARGS.output_dir, REFERENCE_NAME)
-            tmp_path = shutil.make_archive(basename, 'zip', REFERENCE_PATH)
+            tmp_path = shutil.make_archive(basename, 'zip',
+                                           root_dir=ARGS.output_dir, 
+                                           base_dir=REFERENCE_NAME)
             final_path = os.path.join(REFERENCE_PATH, BLENDER_ZIP_FILENAME)
             os.rename(tmp_path, final_path)
 




More information about the Bf-blender-cvs mailing list