mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
[#891]: Fix building the Arabic dictionary on windows.
This commit is contained in:
@@ -116,6 +116,7 @@ tests/*.check
|
||||
!tests/mbrola.test
|
||||
!tests/dictionary.test
|
||||
!tests/cmd_options.test
|
||||
!tests/windows-data.test
|
||||
!tests/windows-installer.test
|
||||
|
||||
espeak-ng.pc
|
||||
|
||||
@@ -325,5 +325,5 @@
|
||||
<Target Name="zhy" Inputs="$(ProjectDir)..\..\dictsource\zhy_rules;$(ProjectDir)..\..\dictsource\zhy_list" Outputs="$(ProjectDir)..\..\espeak-ng-data\zhy_dict" DependsOnTargets="Phonemes">
|
||||
<Exec Command="cd $(ProjectDir)..\..\dictsource && $(TargetDir)espeak-ng.exe --path=$(ProjectDir)..\.. --compile=yue" />
|
||||
</Target>
|
||||
<Target Name="Dictionaries" DependsOnTargets="af;am;an;as;az;bg;bn;bs;ca;cs;cy;da;de;el;en;eo;es;et;eu;fa;fi;fr;ga;gd;gn;grc;gu;hi;hr;hu;hy;ia;id;is;it;jbo;ja;ka;kl;kn;ko;ku;ky;la;lfn;lt;lv;mk;ml;mr;ms;mt;my;nci;ne;nl;no;om;or;pa;pap;pl;pt;ro;ru;si;sk;sl;sq;sr;sv;sw;ta;te;tn;tr;tt;ur;vi;zh;zhy" />
|
||||
<Target Name="Dictionaries" DependsOnTargets="af;am;an;ar;as;az;bg;bn;bs;ca;cs;cy;da;de;el;en;eo;es;et;eu;fa;fi;fr;ga;gd;gn;grc;gu;hi;hr;hu;hy;ia;id;is;it;jbo;ja;ka;kl;kn;ko;ku;ky;la;lfn;lt;lv;mk;ml;mr;ms;mt;my;nci;ne;nl;no;om;or;pa;pap;pl;pt;ro;ru;si;sk;sl;sq;sr;sv;sw;ta;te;tn;tr;tt;ur;vi;zh;zhy" />
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import os
|
||||
import xml.etree.ElementTree as etree
|
||||
|
||||
passed = True
|
||||
|
||||
def check_result(check, message):
|
||||
global passed
|
||||
if check:
|
||||
print('passed')
|
||||
elif message:
|
||||
print('failed: ' + message)
|
||||
passed = False
|
||||
else:
|
||||
print('failed')
|
||||
passed = False
|
||||
|
||||
def check_missing(items, target):
|
||||
missing = []
|
||||
for item in items:
|
||||
if not item in target:
|
||||
missing.append(item)
|
||||
check_result(len(missing) == 0, ', '.join(missing))
|
||||
return missing
|
||||
|
||||
def all_descendants(proj, name):
|
||||
for e in proj.iter():
|
||||
if e.tag == '{http://schemas.microsoft.com/developer/msbuild/2003}' + name:
|
||||
yield e
|
||||
|
||||
def children(e, name):
|
||||
for c in e:
|
||||
if not isinstance(c, str):
|
||||
if c.tag == '{http://schemas.microsoft.com/developer/msbuild/2003}' + name:
|
||||
yield c
|
||||
|
||||
def element_map(proj, name):
|
||||
print('testing for duplicate \'' + name + '\' names ... ', end='')
|
||||
items = {}
|
||||
duplicates = []
|
||||
for e in all_descendants(proj, name):
|
||||
id = e.attrib.get("Name")
|
||||
if id in items.keys():
|
||||
duplicates.append(id)
|
||||
else:
|
||||
items[id] = e
|
||||
check_result(len(duplicates) == 0 , ', '.join(duplicates))
|
||||
return items
|
||||
|
||||
def list_dictionaries():
|
||||
for file in os.listdir('dictsource'):
|
||||
if file.endswith('_rules'):
|
||||
yield file.split('_')[0]
|
||||
|
||||
# 1. Check for missing/duplicate names #################################################################################
|
||||
|
||||
proj = etree.parse('src/windows/data.vcxproj').getroot()
|
||||
targets = element_map(proj, 'Target')
|
||||
|
||||
# 2. Check for missing dictionaries ####################################################################################
|
||||
|
||||
dictionaries = list(list_dictionaries())
|
||||
depends_on_dictionaries = targets['Dictionaries'].attrib.get('DependsOnTargets').split(';')
|
||||
|
||||
print('testing for missing dictionary targets ... ', end='')
|
||||
check_missing(depends_on_dictionaries, targets.keys())
|
||||
|
||||
print('testing for missing dependencies on dictionaries ... ', end='')
|
||||
check_missing(set.intersection(set(dictionaries), set(targets.keys())), depends_on_dictionaries)
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
if not passed:
|
||||
sys.exit(-1)
|
||||
Reference in New Issue
Block a user