forked from nvaccess/nvda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
comInterfaces_sconscript
executable file
·59 lines (52 loc) · 2.22 KB
/
comInterfaces_sconscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
###
#This file is a part of the NVDA project.
#URL: http://www.nvda-project.org/
#Copyright 2006-2010 NVDA contributers.
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License version 2.0, as published by
#the Free Software Foundation.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#This license can be found at:
#http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
###
Import(
'env',
)
def interfaceAction(target,source,env):
clsid=env.get('clsid')
if clsid:
source=(clsid,env['majorVersion'],env['minorVersion'])
else:
source=str(source[0])
comtypes.client.GetModule(source)
interfaceBuilder=env.Builder(
action=env.Action(interfaceAction),
)
env['BUILDERS']['comtypesInterface']=interfaceBuilder
#Bit of a dance to force comtypes generated interfaces in to our directory
import comtypes.client
comtypes.client.gen_dir=Dir('comInterfaces').abspath
import sys
sys.modules['comtypes.gen']=comtypes.gen=__import__("comInterfaces",globals(),locals(),[])
COM_INTERFACES = {
"UIAutomationClient.py": ('{944de083-8fb8-45cf-bcb7-c477acb2f897}',1,0),
"IAccessible2Lib.py": "typelibs/ia2.tlb",
"ISimpleDOM.py": "typelibs/ISimpleDOMNode.tlb",
"mathPlayer.py": "typelibs/mathPlayerDLL.tlb",
#"Accessibility.py": ('{1EA4DBF0-3C3B-11CF-810C-00AA00389B71}',1,0),
"tom.py": ('{8CC497C9-A1DF-11CE-8098-00AA0047BE5D}',1,0),
"SpeechLib.py": ('{C866CA3A-32F7-11D2-9602-00C04F8EE628}',5,0),
"AcrobatAccessLib.py": "typelibs/AcrobatAccess.tlb",
"FlashAccessibility.py": "typelibs/FlashAccessibility.tlb",
}
for k,v in COM_INTERFACES.iteritems():
target=Dir('comInterfaces').File(k)
source=clsid=majorVersion=None
if isinstance(v,basestring):
env.comtypesInterface(target,v)
else:
env.comtypesInterface(target,Dir('comInterfaces').File('__init__.py'),clsid=v[0],majorVersion=v[1],minorVersion=v[2])
#When cleaning comInterfaces get rid of everything except for things starting with __ (e.g. __init__.py)
env.Clean(Dir('comInterfaces'),Glob('comInterfaces/[!_]*')+Glob('comInterfaces/_[!_]*'))