~hannes-hochreiner/jessyink/trunk

80.2.2 by Hannes Hochreiner
Updated documentation and changed from CMake to SCons for building the documentation.
1
import os
2
3
def the_jessyink_book(target, source, env):
4
	xmlFile = None
5
	xslFile = None
6
	svgFiles = []
7
	cssFiles = []
8
9
	for file in source:
10
		(root, ext) = os.path.splitext(str(file))
11
12
		if (ext == '.xsl') & (xslFile == None):
13
			xslFile = str(file)
14
		elif (ext == '.xml') & (xmlFile == None):
15
			xmlFile = str(file)
16
		elif ext == ('.svg'):
17
			svgFiles.append(str(file))
18
		elif ext == ('.css'):
19
			cssFiles.append(str(file))
20
80.2.4 by Hannes Hochreiner
Integrated the production of the packages into the SCons workflow.
21
	dirName = str(target[0]) + os.sep
80.2.2 by Hannes Hochreiner
Updated documentation and changed from CMake to SCons for building the documentation.
22
23
	os.system('xsltproc --xinclude --stringparam base.dir ' + dirName + ' ' + xslFile + ' ' + xmlFile)
24
25
	for file in svgFiles:
26
		(root, ext) = os.path.splitext(os.path.basename(file))
80.2.3 by Hannes Hochreiner
Updated the transition documentation and switched to Inkscape for converting the svg images to png.
27
		os.system('inkscape --without-gui --file=' + file  + ' --export-dpi=96 --export-png=' + os.path.join(dirName, root) + '.png')
80.2.2 by Hannes Hochreiner
Updated documentation and changed from CMake to SCons for building the documentation.
28
	
29
	for file in cssFiles:
30
		os.system('cp ' + file + ' ' + os.path.join(dirName, os.path.basename(file)))
31
32
	return None
33
34
def google_code_wiki(target, source, env):
35
	xslFile = None
36
	svgFiles = []
37
	xmlFiles = []
38
39
	for file in source:
40
		(root, ext) = os.path.splitext(str(file))
41
42
		if (ext == '.xsl') & (xslFile == None):
43
			xslFile = str(file)
44
		elif (ext == '.xml'):
45
			xmlFiles.append(str(file))
46
		elif ext == ('.svg'):
47
			svgFiles.append(str(file))
48
	
80.2.4 by Hannes Hochreiner
Integrated the production of the packages into the SCons workflow.
49
	dirName = str(target[0]) + os.sep
80.2.2 by Hannes Hochreiner
Updated documentation and changed from CMake to SCons for building the documentation.
50
	
51
	os.mkdir(dirName)
52
53
	for file in svgFiles:
54
		(root, ext) = os.path.splitext(os.path.basename(file))
80.2.3 by Hannes Hochreiner
Updated the transition documentation and switched to Inkscape for converting the svg images to png.
55
		os.system('inkscape --without-gui --file=' + file  + ' --export-dpi=96 --export-png=' + os.path.join(dirName, root) + '.png')
80.2.2 by Hannes Hochreiner
Updated documentation and changed from CMake to SCons for building the documentation.
56
57
	for file in xmlFiles:
58
		(root, ext) = os.path.splitext(os.path.basename(file))
59
		os.system('xsltproc --xinclude -o ' + os.path.join(dirName, root) + '.txt' + ' ' + xslFile + ' ' + str(file))
60
61
	return None
62
63
env = Environment()
64
65
env.Append(BUILDERS = {'theJessyInkBook' : Builder(action = the_jessyink_book)})
80.2.4 by Hannes Hochreiner
Integrated the production of the packages into the SCons workflow.
66
env.theJessyInkBook(Dir('the_jessyink_book'), ['the_jessyink_book.xml', 'the_jessyink_book.xsl', 'the_jessyink_book.css', env.Glob('user_documentation/*'), env.Glob('developer_documentation/*')])
80.2.2 by Hannes Hochreiner
Updated documentation and changed from CMake to SCons for building the documentation.
67
68
env.Append(BUILDERS = {'googleCodeWiki' : Builder(action = google_code_wiki)})
80.2.4 by Hannes Hochreiner
Integrated the production of the packages into the SCons workflow.
69
env.googleCodeWiki(Dir('google_code_wiki'), ['google_code_wiki.xsl', env.Glob('user_documentation/*.xml'), env.Glob('user_documentation/*.svg'), env.Glob('developer_documentation/*.xml'), env.Glob('developer_documentation/*.svg')])
80.2.2 by Hannes Hochreiner
Updated documentation and changed from CMake to SCons for building the documentation.
70