Also: - scons: Fix copying wrong scenario graphics on Windows - MSVC: Fix output filenames for release builds
58 lines
2.1 KiB
Python
58 lines
2.1 KiB
Python
|
|
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
|
|
|
|
if str(platform) == "darwin":
|
|
scen_gfx = Glob("Blades of Exile Scenarios/*.meg")
|
|
elif str(platform) == "win32":
|
|
scen_gfx = Glob("Blades of Exile Scenarios/*.BMP")
|
|
|
|
env.Install(path.join(install_dir, "Blades of Exile Scenarios"), Glob("Blades of Exile Scenarios/*.exs") + scen_gfx)
|
|
env.Install(path.join(install_dir, "Blades of Exile Base"), Glob("Blades of Exile Bases/*.exs"))
|
|
|
|
have_xmllint = False
|
|
|
|
if ((str(platform) != "win32" and subprocess.call(['which', '-s', 'xmllint']) == 0) or
|
|
(str(platform) == "win32" and subprocess.call(['where', '/Q', '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 used
|
|
def validate_dialog(target, source, env):
|
|
PIPE = subprocess.PIPE
|
|
with open(target[0].abspath, 'w') as log:
|
|
src_name = path.basename(source[0].path)
|
|
cmd_line = xmllint_command + (src_name,)
|
|
print(*cmd_line)
|
|
p = subprocess.Popen(cmd_line,
|
|
bufsize=1, stdin=PIPE, stdout=PIPE, stderr=PIPE,
|
|
cwd=source[0].Dir('.').abspath
|
|
)
|
|
out, err = p.communicate()
|
|
print(err, end='')
|
|
print(err, file=log)
|
|
return p.returncode
|
|
# We use these .log files as dummy targets, basically (though they also store the validation results)
|
|
env.Append(BUILDERS={"ValidateDialogXml": Builder(action=validate_dialog,suffix='.log',src_suffix='.xml')})
|
|
for dlg in Glob('dialogs/*.xml'):
|
|
dlg = path.basename(dlg.path).split('.')[0]
|
|
env.ValidateDialogXml(path.join("#build/dialogs", dlg), path.join("dialogs", dlg))
|
|
else:
|
|
print("Note: Skipping XML dialog validation since no validator tool was found.")
|