From: Graham Percival <graham@percival-music.ca>
Date: Mon, 8 Mar 2010 12:02:19 +0000 (+0000)
Subject: Web build: add .en.html symlinks.
X-Git-Tag: release/2.13.16-1~42^2~4
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=52f4a2957f80d5f3fe578f0238c3768f4eca7766;p=lilypond.git

Web build: add .en.html symlinks.

According to the old python scripts, this is necessary for
automatic language selection.  I don't know if that's true or not,
but it's an easy addition.

Next step: refactor this file and conform to lilypond's python
guidelines.
---

diff --git a/scripts/build/website_post.py b/scripts/build/website_post.py
index bf04895c77..9846db819d 100644
--- a/scripts/build/website_post.py
+++ b/scripts/build/website_post.py
@@ -30,7 +30,9 @@ lang_other_langs = {
 indir = sys.argv[1]
 outdir=indir
 
-html_files = glob.glob( os.path.join(indir, '*.html') )
+os.chdir(indir)
+
+html_files = glob.glob( '*.html' )
 
 # messy way to get all languages
 langs_set = set()
@@ -77,6 +79,9 @@ for file in html_files:
 	if (len(file_split) == 2):
 		# it's English
 		lang = ''
+		# possibly necessary for automatic language selection
+		file_symlink =file.replace(".html", ".en.html")
+		os.symlink (file, file_symlink)
 	else:
 		# it's a translation
 		lang = file_split[1]
@@ -93,7 +98,7 @@ for file in html_files:
 	# ick
 	lang_footer = makeFooter(lang, out_filename.split('.')[0])
 	
-	outfile = open( os.path.join(outdir, out_filename), 'w')
+	outfile = open( out_filename, 'w')
 	for line in lines:
 		# avoid external links
 		if ((line.find("href") >= 0) and (line.find("http")==-1)):