Commits

jacobmason committed 3fa44c2

copy static files from build dir to demo static dir after build

Comments (0)

Files changed (1)

     :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
     :license: BSD, see LICENSE for details.
 """
-
+import os
+import shutil
 
 from flask import Flask
 
                      search=app.config['SEARCH'],
                      storage=app.config['DATABASE_URI'])
 support.build()
+
+demo_static_dir = os.path.join(os.getcwd(), 'sphinxdemo', 'static')
+
+static_dirs = ['_static', '_sources', '_images']
+
+for directory in static_dirs:
+    src = os.path.join(app.config['BUILD_DIR'], 'static', directory)
+    dst = os.path.join(demo_static_dir, directory)
+    if os.path.isdir(src):
+        if os.path.isdir(dst):
+            shutil.rmtree(dst)
+        shutil.copytree(src, dst)