summaryrefslogtreecommitdiff
path: root/scripts/auxiliar
diff options
context:
space:
mode:
authorGraham Percival <graham@percival-music.ca>2011-09-18 00:32:14 +0100
committerGraham Percival <graham@percival-music.ca>2011-10-24 07:24:07 +0100
commit16cb69b3499ac84dd512286c6aa6674b27c24870 (patch)
treefd1e0ba1823b1feb3ec02dd3f3182fd27eaa21fb /scripts/auxiliar
parent6ee8c04678442855cb794d4598c056c15c42673b (diff)
website build: copy picture files to web-media
Diffstat (limited to 'scripts/auxiliar')
-rwxr-xr-xscripts/auxiliar/prepare-web-media.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/scripts/auxiliar/prepare-web-media.py b/scripts/auxiliar/prepare-web-media.py
new file mode 100755
index 0000000000..d10687ae63
--- /dev/null
+++ b/scripts/auxiliar/prepare-web-media.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+
+import os
+import sys
+import glob
+import shutil
+
+try:
+ lilypond_git_dir = os.environ["LILYPOND_GIT"]
+ lilypond_web_media_dir = os.environ["LILYPOND_WEB_MEDIA_GIT"]
+except KeyError:
+ print "Error: you must have these environment variables defined:"
+ print " $LILYPOND_GIT"
+ print " $LILYPOND_WEB_MEDIA_GIT"
+ sys.exit(1)
+
+build_dir = os.path.join(lilypond_git_dir, 'build')
+
+def get_pictures_from(dirname):
+ try:
+ examine_dirname = os.path.join(build_dir,
+ "Documentation", dirname, "out-www")
+ filenames = (
+ glob.glob(os.path.join(examine_dirname, "*.png")) +
+ glob.glob(os.path.join(examine_dirname, "*.jpg")))
+ except:
+ print "Cannot find files (maybe a problem with your build directory?)"
+ return filenames
+
+pictures_filenames = get_pictures_from("pictures")
+ly_examples_filenames = get_pictures_from(os.path.join("web", "ly-examples"))
+
+pictures_dest = os.path.join(lilypond_web_media_dir, "pictures")
+ly_examples_dest = os.path.join(lilypond_web_media_dir, "ly-examples")
+for filename in pictures_filenames:
+ shutil.copy(filename, pictures_dest)
+for filename in ly_examples_filenames:
+ shutil.copy(filename, ly_examples_dest)
+
+print "Finished copying."
+print "Don't forget to git commit and push to the lilypond-web-media repository!"
+