~stomato463/+junk/nvdajp

« back to all changes in this revision

Viewing changes to source/generateComInterfaces.py

  • Committer: Masataka Shinke
  • Date: 2011-10-25 12:35:26 UTC
  • mfrom: (4185 jpmain)
  • mto: This revision was merged to the branch mainline in revision 4211.
  • Revision ID: mshinke@users.sourceforge.jp-20111025123526-ze527a2rl3z0g2ky
lp:~nishimotz/nvdajp/main : 4185 をマージ

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#generate.py
 
1
#generateComInterfaces.py
2
2
#A part of NonVisual Desktop Access (NVDA)
3
3
#This file is covered by the GNU General Public License.
4
4
#See the file COPYING for more details.
5
5
#Copyright (C) 2006-2010 Michael Curran <mick@kulgan.net>, James Teh <jamie@jantrid.net>
6
6
 
7
 
"""Script to prepare an NVDA source tree for optimal execution.
8
 
This script:
9
 
* Generates Python code for COM interfaces to avoid doing this at runtime;
10
 
* Compiles source language files into binary form for use by NVDA;
11
 
* Generates the HTML documentation.
12
 
This should be run prior to executing NVDA from a clean source tree for the first time and before building a binary distribution with py2exe.
 
7
"""Script to generate Python code for required COM interfaces.
 
8
This script will be run by SCons as appropriate.
13
9
"""
14
10
 
15
11
#Bit of a dance to force comtypes generated interfaces in to our directory
16
12
import comtypes.client
17
13
comtypes.client.gen_dir='.\\comInterfaces'
18
 
import comtypes
19
14
import sys
20
15
sys.modules['comtypes.gen']=comtypes.gen=__import__("comInterfaces",globals(),locals(),[])
21
16
 
22
 
import os
23
 
from glob import glob
24
 
import txt2tags
25
 
 
26
17
COM_INTERFACES = (
27
18
        ("UI Automation", comtypes.client.GetModule, "UIAutomationCore.dll"),
28
19
        ("IAccessible 2", comtypes.client.GetModule, "typelibs/ia2.tlb"),
44
35
                        print "not found."
45
36
        print
46
37
 
47
 
        print "Language files:"
48
 
        poFiles=glob('locale/*/LC_MESSAGES/nvda.po')
49
 
        for f in poFiles:
50
 
                print f
51
 
                os.spawnv(os.P_WAIT,r"%s\python.exe"%sys.exec_prefix,['python',r'"%s\Tools\i18n\msgfmt.py"'%sys.exec_prefix,f])
52
 
        print
53
 
 
54
 
        print "HTML documentation:"
55
 
        files = glob(r"..\user_docs\*\*.t2t")
56
 
        # Using txt2tags as a module to handle files is a bit weird.
57
 
        # It seems simplest to pretend we're running from the command line.
58
 
        txt2tags.exec_command_line(files)
59
 
        print
60
 
 
61
38
if __name__ == "__main__":
62
39
        main()