from __future__ import print_function import os.path as path import subprocess Import("env platform data_dir install_dir") # Data env.Install(data_dir, Dir("cursors")) env.Install(data_dir, Dir("dialogs")) env.Install(data_dir, Dir("fonts")) env.Install(data_dir, Dir("graphics")) env.Install(data_dir, Dir("sounds")) env.Install(data_dir, Dir("strings")) env.Install(path.join(data_dir, "shaders"), Glob("#src/tools/mask.*")) # Scenarios env.Install(path.join(install_dir, "Blades of Exile Scenarios"), Glob("Blades of Exile Scenarios/*.exs") + Glob("Blades of Exile Scenarios/*.meg")) env.Install(path.join(install_dir, "Blades of Exile Base"), Glob("Blades of Exile Bases/*.exs")) if str(platform) != "win32" and subprocess.call(['which', '-s', 'xmllint']) == 0: have_xmllint = True xmllint_command = ('xmllint', '--nonet', '--noout', '--schema', '../schemas/dialog.xsd') if have_xmllint: # This is separate so that alternate xml validators could be user def validate_dialogs(target, source, env): sources = source PIPE = subprocess.PIPE with open(target[0].path, 'w') as log: for source in sources: src_name = path.basename(source.path) if src_name == 'dialog.xsd': continue cmd_line = xmllint_command + (src_name,) print(*cmd_line) p = subprocess.Popen(cmd_line, bufsize=1, stdin=PIPE, stdout=PIPE, stderr=PIPE, cwd=Dir('rsrc/dialogs').abspath ) out, err = p.communicate() print(err, end='') print(err, file=log) env.Command('#build/dialogs.log', Glob('dialogs/*.xml') + ['schemas/dialog.xsd'], validate_dialogs)