From: Graham Percival Date: Sat, 17 Sep 2011 23:32:14 +0000 (+0100) Subject: website build: copy picture files to web-media X-Git-Tag: release/2.15.15-1~3 X-Git-Url: https://git.donarmstrong.com/lilypond.git?a=commitdiff_plain;h=16cb69b3499ac84dd512286c6aa6674b27c24870;p=lilypond.git website build: copy picture files to web-media --- 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!" +