tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
]\¬Qc @sêdZddlmZedddƒddlZddlZddlZddlZddlZddlZddl    Z    ddl
Z
ddl Z ddl Z ddl ZddlZddlTddlZddlZddlZddlZejje jƒZejjedƒZejjƒZd    „Zd
„Zd d d „Z d„Z!e"e"e"e"e"e"d„Z#e"e"e"e"e"e"d„Z$e"d„Z%e"e"e"e"e"d„Z&d„Z'e"d„Z(d„Z)d„Z*d„Z+d„Z,d„Z-d„Z.d„Z/d„Z0d„Z1d„Z2e-dfe.d fe+d!fgZ3e.d"fe-d#fe3d$fgZ4e.d"fe.d fe-d%fe-d&fe3d'fe3d(fe0d)e4fgZ5e.d"fe-d*fe3d$fgZ6e-dfe0d+e-fgZ7e.d"fe-d,fe.d fe0d-e6fe0d.e7fgZ8e.d/fe-d0fe.d1fgZ9e.d2fe-d3fe.d4fgZ:e-d5fe0d6e:fgZ;e.d7fe.d8fe-d9fe+d:fe+d;fe0d<e5fe0d=e8fe0d>e9fe0d?e;fg    Z<e+d@fe+dAfe+dBfe0dCe<fgZ=e"e"e"e"e"dD„Z>dEfdF„ƒYZ?dGfdH„ƒYZ@dIfdJ„ƒYZAdK„ZBdL„ZCdM„ZDdN„ZEdO„ZFidPdQ6dRdS6dTdU6dVdW6ZGdX„ZHdY„ZIdZ„ZJeKd[kræeƒejLd\ƒndS(]s§
gensuitemodule - Generate an AE suite module from an aete/aeut resource
 
Based on aete.py.
 
Reading and understanding this code is left as an exercise to the reader.
iÿÿÿÿ(twarnpy3ks-In 3.x, the gensuitemodule module is removed.t
stackleveliN(t*slib-scriptpackagescCs<tjjdtjdƒtjjdƒtjdƒdS(Ns.Usage: %s [opts] application-or-resource-file
isÑOptions:
--output pkgdir  Pathname of the output package (short: -o)
--resource       Parse resource file in stead of launching application (-r)
--base package   Use another base package in stead of default StdSuites (-b)
--edit old=new   Edit suite names, use empty new to skip a suite (-e)
--creator code   Set creator code for package (-c)
--dump           Dump aete resource to stdout in stead of creating module (-d)
--verbose        Tell us what happens (-v)
i(tsyststderrtwritetargvtexit(((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pytusage"s    cCs3ttjƒdkr(d}d#}y&tjtjd||ƒ\}}Wntjk
rdtƒnXt}d
}d}g}d}d}    d}
x|D]    \} } | d$kr·t}n| d%krÌ| }n| d&krá| }n| d'kr(| j    dƒ} t| ƒdkrtƒn|j
| ƒn| d(krot| ƒdkrftj j dƒtj dƒn| }n| d)kr‡tj}    n| d*kr–tj }
q–q–W|ræt|ƒdkrætj j dtjdƒtj dƒnxF|D]4}||d|d |d!|d"|d|    d    |
ƒqíWntƒdS(+Nis rb:o:e:c:dvtresourcesbase=soutput=sedit=screator=tdumptverboset    StdSuitess-rs
--resources-bs--bases-os--outputs-es--editt=is-cs    --creatoriscreator must be 4-char string
s-ds--dumps-vs    --verboses1%s: cannot specify --output with multiple inputs
itoutputt basepkgnamet edit_modnamestcreatorsignature(R    sbase=soutput=sedit=screator=sdumpsverbose(s-rs
--resource(s-bs--base(s-os--output(s-es--edit(s-cs    --creator(s-ds--dump(s-vs    --verbose(tlenRRtgetoptt GetoptErrorRt processfiletNonetprocessfile_fromresourcetsplittappendRRRtstdouttmain_interactive(t    SHORTOPTStLONGOPTStoptstargst process_funcRRRRR
R totaRtfilename((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pytmain/sV&                 
          iR cCsü|rd}ng}tjjdddƒ}tjddddd|ƒ}|sUdSt|ƒstjd    d
d d d ddƒdkrdSny#t|d|d|dt    j
ƒWnCt j k
r÷}dG|GHdGHt |d|d|dt    j
ƒnXdS(Ni€ÿÿtappsitmessagesSelect scriptable applicationtdialogOptionFlagsiVtdefaultLocations-Warning: application does not seem scriptabletyestContinuetdefaultitnotRRR sError getting terminology:s!Retry, manually parsing resources(RtCarbontFoldert FSFindFoldert EasyDialogstAskFileForOpent is_scriptabletAskYesNoCancelRRRtMacOStErrorR(tinteractRRt
appsfolderR#targ((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRbs.                 cCsètjj|ƒrbtjj|ddƒ}tjj|ƒs@tStjj|ƒ}|j    dtƒSt
ƒ}yt j |ƒ}Wnt jk
r•tSXt|ƒtdƒtdƒtdƒtdƒ}t|ƒt|ƒ|dkS(    s,Return true if the application is scriptabletContentss
Info.plisttNSAppleScriptEnabledtaetetaeuttscsztosizi(tostpathtisdirtjointexiststFalsetplistlibtPlisttfromFiletgett
CurResFilet macresourcet open_pathnameR5R6t
UseResFiletCount1Resourcest CloseResFile(t applicationt    plistfiletplisttcurrftrefnot n_terminology((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyR3~s     
*
 
cCsåt|ƒ r$|r$|d|IJntƒ}|rF|dI|IJntj|ƒ}zt|ƒg}    x:ttdƒƒD]&}
tdd|
ƒ} |    j| ƒq{Wx:ttdƒƒD]&}
tdd|
ƒ} |    j| ƒq¸W|r|dIt    |ƒIJng} xd|    D]\} |r9|dI| j
ƒIdIJn| j } t | |ƒ}| j|| j
ƒfƒqWWd    ||kr•t |ƒt|ƒnXt|ƒ|r¶t| |ƒnt| |d
|d |d |d |d|ƒd    S(s&Process all resources in a single files)Warning: app does not seem scriptable: %st
ProcessingR<iR=s
LISTING aete+aeut RESOURCES INtdecodings...NRRRRR (R3RJRKRLRMtrangeRNtGet1IndResourceRtreprt
GetResInfotdatatdecodeROt dumpaetelisttcompileaetelist(tfullnameRRRRR
R tcurtrft    resourcestitrestaetelistR\R<((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyR“sB    
     ! 
 
 cCs«t|ƒ r$|r$|d|IJn|rC|dIt|ƒIJnytj|ƒ\}}Wnftjk
rÄ}    |    ddkr¾|r”|dIJnt|d|ƒ\}
} |sÁ| }qÁqM‚n‰X|rç|rç|dI|IJqçntj|ƒ} | s|r|d    I| IJnd
S| dj    sC|r?|d I| IJnd
S| d}
t
|
j    |ƒ} |ryt | g|ƒd
St | d
|d |d |d|d|d|ƒd
S(s7Ask an application for its terminology and process thats)Warning: app does not seem scriptable: %ss
ASKING FOR aete DICTIONARY INii[ùÿÿi@ÿÿÿsLGetAppTerminology failed with errAEDescNotFound/resNotFound, trying manuallyR tLaunchedsUnpack returned empty value:Ns#Unpack returned value without data:RRRR(i[ùÿÿi@ÿÿÿ(R3RZtOSATerminologytGetAppTerminologyR5R6tgetappterminologytaetoolstunpackR\R]R^t compileaeteR(R`RRRRR
R t    aedescobjtlaunchedR9taedatatsigtrawR<((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRºsD   
 c
Cs5tjƒstd‚nddl}|jjddƒtjj|ƒr¤tjj    |ddƒ}tjj
|ƒstd‚nt |dƒj ƒ}|d    d
!}ntj |ƒ\}}tj|ƒ}y|jƒWn8tjtjfk
r}|r|d I|IJqnX|jd d ƒ}    |    dd|fS(s4Get application terminology by sending an AppleEvents4Cannot send AppleEvents, no access to window manageriÿÿÿÿNiR:tPkgInfosNo PkgInfo file foundtrbiis+Warning: start() failed, continuing anyway:tascrtgdteis----(R5t WMAvailablet RuntimeErrort
Carbon.EvttEvtt WaitNextEventR@RARBRCRDtopentreadtGetCreatorAndTypeRktTalkTot_startR6tsend(
R`R R.tpkginfottp_crtcrttpttalkerR9treply((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRjãs&    c    CsIxB|D]:\}}t|||d|d|d|d|d|ƒqWdS(NRRRRR (Rm(    RfR`RRRRR R<tresinfo((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyR_s cCs ddl}|j||ƒdS(Niÿÿÿÿ(tpprint(RfRR‰((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyR^
s cCstj|ƒ}tt|ƒ}t|ƒ}|jƒ}t|jƒƒ}|jƒ}|r}|r}|jd|||fƒn|S(s.Decode a resource into a python data structures)%d processed + %d unprocessed = %d total
(tStringIOtgenerictgetaetetsimplifyttellRR}R(R\R tfR<t    processedt unprocessedttotal((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyR]s        cCs_t|ƒtjkr"tt|ƒSt|ƒtjkrWt|ƒdkrWt|dƒS|SdS(s>Recursively replace singleton tuples by their constituent itemiiN(ttypettypestListTypetmapRt    TupleTypeR(titem((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRs
 'cGs5|jdƒ}|s+tdt|ƒ‚nt|ƒS(Nis
in getbyte(R}tEOFErrortstrtord(RRtc((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pytgetbyte)scGsat|ƒ|jdƒ}t|ƒdkrAtdt|ƒ‚nt|dƒd>t|dƒBS(Nis
in getwordiii(tgetalignR}RR™RšR›(RRts((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pytgetword/s
 
cGs…t|ƒ|jdƒ}t|ƒdkrAtdt|ƒ‚nt|dƒd>t|dƒd>Bt|dƒd>Bt|d    ƒBS(
Nis
in getlongiiiiiii(RžR}RR™RšR›(RRRŸ((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pytgetlong6s
 
cGsEt|ƒ|jdƒ}t|ƒdkrAtdt|ƒ‚n|S(Nis in getostype(RžR}RR™Rš(RRRŸ((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyt    getostype=s
 
cGsŽ|jdƒ}t|ƒdkr7tdt|ƒ‚nt|ƒ}|dkrSdS|j|ƒ}t|ƒ|krŠtdt|ƒ‚n|S(Nis in getpstr[1]iR-s in getpstr[2](R}RR™RšR›(RRRœtnbytesRŸ((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pytgetpstrDs  cCs&|jƒd@r"|jdƒ}ndS(Ni(RŽR}(RRœ((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRžOscCsMt|ƒ}g}x4t|ƒD]&}|jt||ƒƒt|ƒqW|S(N(R RXRR‹Rž(Rt descriptiontgetitemtcounttlistRd((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pytgetlistUs  cGs8dGt|ƒG|GHt|||ƒ}dGt|ƒGH|S(NR‹s->(RZt    vageneric(twhatRRRe((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyt alt_generic]scGst|ƒtjkr)t||f|ƒSt|ƒtjkr’g}xG|D]?}tt|d |f|dƒ}|j|d|fƒqKW|Sd|fS(NisBAD GENERIC ARGS: %r(R“R”t FunctionTypetapplyR•R‹R(R«RRtrecordtthingR˜((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyR‹cs "R“R¥tflagstnametkeywordR«s
suite codes
event codetreturnstacceptssoptional argumentstcodetkeyforms
class codet
propertiestelementss operator names operator IDsoperator commentsenumerator names enumerator IDsenumerator commentsenumeration IDt
enumerators
suite namessuite descriptionssuite IDs suite levels suite versionteventstclassest comparisonst enumerationssmajor/minor version in BCDs language codes script codetsuitesc"    Csœ|\}}    }
} t|dƒ\} } |sEtj|ƒ\}}nttjjtjj|ƒƒdƒ}|    r„|d|    }n|
r›|d|
}nt|ƒdkrº|d }n|rëtjj    |ƒsâtj
|ƒn|}n"t j dd|dt ƒ}|}|sd    Stjjtjj|ƒƒd
}|sZt j dd dtƒ}n|r¾tjjtjj|ƒƒ\}}|r¯|tjkr¯tjjd|ƒnt|ƒ}nd    }g}g}g}x€| D]x}t|||||ƒ}|jƒ\}}}|sqÝn||}|||f}|j||fƒ|j|ƒqÝWx*|D]"}|j| | |    |
||ƒq`Wtjj|d ƒ}t|d ƒ}tj|ddƒ|jdƒ|jdt|ƒƒ|r|jdt|d
ƒ|dt|dƒfƒn|jdƒ|jdƒ|jdƒ|jƒx%|D]\}}|jd|ƒqTW|jdƒx1|D])\}}|jdt|ƒ|fƒq‰W|jdƒ|jdƒx7|D]/\}}|jdt|ƒ|||fƒq×W|jdƒx%|D]\}}|jd|ƒqW|jdƒ|jdƒ|jdƒ|jd ƒ|jd!ƒ|jd"ƒ|jd#ƒ|jd$ƒ|jd%ƒ|jd&ƒ|jd'ƒ|jd(ƒ|jd)ƒ|jƒ|rJ|jd*ƒxB|D]7}x.|jd+ƒD]\}} |jd,| ƒq"Wq Wnd    }!|rÝ|jd-ƒ|jd.ƒxZ|D]R}xI|jd+ƒD]8\}} |jd/|| fƒ|d0kr| }!qqWqwW|jd1ƒn|rŽ|jd2||dd
fƒx)|d
D]\}}|jd3|ƒq W|jd4ƒ|jd5|fƒ|jd6|ƒ|!rŽ|jd7|!ƒ|jd8|!ƒqŽn|j ƒd    S(9sEGenerate code for a full aete resource. fname passed for doc purposesiis_lang%ds    _script%diR&s'Create and select package folder for %sR(Nis1Package folder for base suite (usually StdSuites)s __init__.pytwtPythtTEXTs"""
sPackage generated from %s
sResource %s resid %d %s
isimport aetools
sError = aetools.Error
s
import %s
s
 
_code_to_module = {
s    '%s' : %s,
s}
 
s
 
_code_to_fullname = {
s    '%s' : ('%s.%s', '%s'),
sfrom %s import *
s
def getbaseclasses(v):
s*    if not getattr(v, '_propdict', None):
s        v._propdict = {}
s        v._elemdict = {}
sB        for superclassname in getattr(v, '_superclassnames', []):
s.            superclass = eval(superclassname)
s'            getbaseclasses(superclass)
sE            v._propdict.update(getattr(superclass, '_propdict', {}))
sE            v._elemdict.update(getattr(superclass, '_elemdict', {}))
s<        v._propdict.update(getattr(v, '_privpropdict', {}))
s<        v._elemdict.update(getattr(v, '_privelemdict', {}))
s
simport StdSuites
sT
#
# Set property and element dictionaries now that all classes have been defined
#
tclasssgetbaseclasses(%s)
s0
#
# Indices of types declared in this module
#
s_classdeclarations = {
s     %r : %s,
tcapps}
s
 
class %s(%s_Eventss,
        %s_Eventss,
        aetools.TalkTo):
s    _signature = %r
 
s    _moduleName = '%s'
 
s    _elemdict = %s._elemdict
s    _propdict = %s._propdict
(!tdivmodR5R~tidentifyR@RAtsplitexttbasenameRRDtmkdirR1t    AskFoldertDEFAULT_USER_PACKAGEFOLDERRtnormpathtDEFAULT_STANDARD_PACKAGEFOLDERRtinsertt
__import__Rt SuiteCompilertprecompilesuiteRt compilesuiteRCR|tSetCreatorAndTypeRtasciitsorttgetalltclose("R<RˆtfnameRRRRR tversiontlanguagetscriptR¿tmajortminortdummyt packagenametpathnametdirnamet basepackaget    suitelisttallprecompinfot    allsuitestsuitetcompilerR¶tmodnamet precompinfot    suiteinfot initfilenametfptcodenamemappertktvtapplication_class((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRm±sÖ(         " $ 
   5   
 !  '              
       RÐcBs>eZd„Zd„Zd„Zd„Zd„Zd„ZRS(cCs^||_||_||_||_||_d|_d|_d|_d|_    i|_
dS(N( RæRâRRR RRàRèRìt
basemodulet enumsneeded(tselfRæRâRRR ((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyt__init__*s                                    c    Csl|j\    }}}}}}}}}    t|ƒ}
t|
ƒdkrO|
d }
n|jd kr€tjddd|
dƒ|_n`x,|jD]!\} } | |
krŠ| }
qŠqŠW|
r×tj    j
|j |
dƒ|_n    d |_|jsíd Stj    j tj    j |jƒdƒd|_|jrG||jjkrG|jj|} nd } i|_x|D]}|j|ƒq]Wtd |j| d    |jd kd
|jƒ}x|D]}|j|ƒq¨Wx|D]}|j|ƒqÆWx|D]}|j|ƒqäWx|    D]}|j|ƒqWx$|jjƒD]}|j|ƒq)W|jƒ|j|jƒ}||j|fS( s´Parse a single suite without generating the output. This step is needed
        so we can resolve recursive references by suites to enums/comps/etc declared
        in other suitesiiR&sPython output filet savedFileNames.pyiiR7R N(NNN(RæRÆRRRR1tAskFileForSaveRàR@RARCRRÇRRèRât_code_to_moduleRòtfindenumsineventtObjectCompilerR t compileclasstfillclasspropsandelemstcompilecomparisontcompileenumerationtkeyst checkforenumt    dumpindextgetprecompinfo(RóR²tdescR¶tlevelRÙR»R¼tcompstenumsRètoldtnewRñteventtobjctclstcomptenumRé((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRÑ:sJ$    "        ,     !     
c Cs|j\    }}}    }
} } } }}d„}| jƒ| j|ƒ|jƒ|jƒt|jdƒ|_}tj|jddƒ|jdt|ƒt|ƒfƒ|jd|
| fƒ|jdt|ƒƒ|jd||||fƒ|jd    ƒ|jd
ƒ|jd ƒ|jd |    fƒ|j    r}|    |j    j
kr}|jd |j    j |    dƒ|j    j
|    }ne|j    rÜ|    j ƒ|j    j
krÜ|jd |j    j |    j ƒdƒ|j    j
|    j ƒ}nd}||_|jƒi|_| r%x+| D]}|j|ƒq Wn |jdƒt||j||d|jdkd|jƒ}x| D]}|j|ƒqiWx| D]}|j|ƒq‡Wx|D]}|j|ƒq¥Wx|D]}|j|ƒqÃWx$|jjƒD]}|j|ƒqêW|jƒdS(s Generate code for a single suitecSs‚|d|dkrdS|d|dkr0dS|d sS|ddddkrWdS|d sz|ddddkr~dSdS(sDSort classes by code, and make sure main class sorts before synonymsiiÿÿÿÿiisc@#!((tk1tk2((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyt class_sorterws##RÀRÁRÂs"""Suite %s: %s
sLevel %d, version %d
 
sGenerated from %s
s9AETE/AEUT resource version %d/%d, language %d, script %d
s"""
 
simport aetools
simport MacOS
 
s _code = %r
 
sfrom %s import *
is
    pass
 
R7R N(RæRÕR|RàRìR5RÓRRÔRâR÷t_code_to_fullnametlowerRRñtcompileclassheaderRòt compileeventRùRèRR RúRûRüRýRþRÿR(RóRÜRÝRÚRÛRØRéR²RR¶RRÙR»R¼RRRRìRñRR    R
R R ((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRÒssX$    
 
 
#       !%    
      $     cCsqd|j}|jrYtj|jjdƒd}d|}|jjd||fƒn|jjd|ƒdS(sGenerate class boilerplates    %s_Eventst.iÿÿÿÿsclass %s(%s):
 
s class %s:
 
N(RèRñtstringRt__name__RìR(Rót    classnamet modshortnamet baseclassname((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyR¼s      
cCsŽ|\}}}}}}}|j}    t|ƒ}
|r|    jd|
ƒx3|D]+} |    jdt| dƒ| dfƒqNW|    jdƒnt|ƒ } | o©t|ƒ} |    jd|
ƒ| ré| sÙ|    jdƒqö|    jdƒn |    jd    ƒ|    jd
ƒ|    jd t|ƒt|ƒfƒ| rF|    jd t|ƒƒn | rf|    jd t|ƒƒnx9|D]1}|    jdt|dƒt|dƒfƒqmW|    jdƒt|ƒsÕ|    jdt|ƒƒn|    jdƒ|    jd|fƒ|    jd|fƒ|r$|    jd|
ƒn |    jdƒ| rG|    jdƒn0| rj|    jdƒ|    jdƒn |    jdƒ|    jdƒxr|D]j} t| dƒr‹| d}| dd}|dkrõ|    jd|t|ƒfƒd|j|<qõq‹q‹W|    jdƒ|    jdƒ|    jdƒ|    jd ƒ|    jd!ƒ|    jd"ƒ|    jd#ƒt|ƒrp|    jd$ƒn|    jd%ƒ|    jdƒd&S('s Generate code for a single events    _argmap_%s = {
s        %r : %r,
iis    }
 
s    def %s(self, s    _object, s_object=None, s_no_object=None, s_attributes={}, **_arguments):
s        """%s: %s
s        Required argument: %s
s        Optional argument: %s
s         Keyword argument %s: %s
isF        Keyword argument _attributes: AppleEvent attribute dictionary
s        Returns: %s
s         """
s        _code = %r
s        _subcode = %r
 
s6        aetools.keysubst(_arguments, self._argmap_%s)
sD        if _arguments: raise TypeError, 'No optional args expected'
s%        _arguments['----'] = _object
s        if _object:
s)            _arguments['----'] = _object
sM        if _no_object is not None: raise TypeError, 'No direct arg expected'
s
s****s4        aetools.enumsubst(_arguments, %r, _Enum_%s)
sE        _reply, _arguments, _attributes = self.send(_code, _subcode,
s)                _arguments, _attributes)
s&        if _arguments.get('errn', 0):
sA            raise aetools.Error, aetools.decodeerror(_arguments)
s(        # XXXX Optionally decode result
s!        if '----' in _arguments:
s4            # XXXX Should do enum remapping here...
s&            return _arguments['----']
N(    RìRÆRtis_nullt is_optionalRÔt
getdatadoctis_enumRò(RóRR²RR¶tsubcodeR´Rµt    argumentsRìtfuncnameR"thas_argtopt_argR9tknametename((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRÆsx      )   #         
              c Csm|\}}}}}}}xK|D]C}    t|    dƒr"|    dd}
|
dkred|j|
<qeq"q"WdS(s!Find all enums for a single eventiis****iN(RRò( RóRR²RR¶RR´RµRR"R$((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRø*s   (Rt
__module__RôRÑRÒRRRø(((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRÐ)s         9    I    
   dtCodeNameMappercBsYeZdd    d„Zd„Zd„Zd„Zd„Zd„Zd„Z    d    d„Z
RS(
icCsriid6id6id6id6|_iid6id6id6id6|_d|_d|_||_||_dS(NtpropertyRÃR t
comparisoni(t    code2namet    name2codeRt
modulenamet star_importedt can_interactR (RóR7R ((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRô<s              cCs<||j||<||j|kr8||j||<ndS(N(R*R)(RóR“R²R¶((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyt addnamecodeNscCs.x'|jjƒD]}||krtSqWtS(N(R*tvaluestTrueRE(RóR²tdict((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pythasnameSs cCs||j|kS(N(R)(RóR“R¶((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pythascodeYscCsf|j||ƒsdS|j||}|jrP|j rPd|j|f}n|}|||jfS(Ns%s.%s(NNN(R3RR)R+R,(RóR“R¶R²tqualname((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyt findcodename\scCs|j|jƒS(N(R)titems(RóR“((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRÖfscCsæ||_||_x0|jjƒD]\}}|jd||ƒq"Wx0|jjƒD]\}}|jd||ƒqUWx4|jjƒD]#}|jddt|ƒ|ƒqˆWx0|j    jƒD]\}}|jd||ƒq¿WdS(NR'RÃR t_Enum_R((
R+R,t_propdeclarationsR6R.t_classdeclarationst_enumdeclarationsRþRÆt_compdeclarations(RótmoduleR²R,R¶((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyt    addmoduleis        !cCs|js||_n|S(N(R+(RóR²((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pytprepareforexportus     N( RR%RRôR.R2R3R5RÖR=R>(((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyR&:s                
        RùcBs’eZdddd„Zd„Zd„Zd„Zd„Zd„Ze    d„Z
d„Z d    „Z d
„Z d „Zd „Zd „Zd„ZRS(icCs©||_||_||_||_||_t|j|jƒg|_|r[||_n    g|_|r¥t|j|jƒ}|j|ddƒ|jj    |ƒndS(NR-i(
RìR t    basesuiteR-R+R&t namemapperstothernamemappersR=R(RóRìRèR?RAR7R t
basemapper((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRô{s                         cCsCg}x6|jD]+}|j|ƒ}|r|j|ƒqqW|S(N(R@R>R(RóRèR¨tmappertemapper((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRŒs cCsxx3|jD](}|j||ƒr |j||ƒSq WxÓ|jD]_}|j||ƒrC|jj|ƒ|jj|ƒ|jrž|jjd|jƒnPqCqCW|jrÄ|j    ||ƒ}nd}|sÔdSt |j |j ƒ}|j||jdƒ|jj|ƒqdS(Ns
import %s
i(NNN(R@R3R5RAtremoveRRìRR+taskdefinitionmoduleRR&R-R R=R(RóR“R¶RCtm((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyR5”s&        cCsnxg|jD]\}|j|ƒr
|j|jkr
|jrb|jdI|I|jI|jIJntSq
WtS(NsDuplicate Python identifier:(RAR2R+R R0RE(RóR²RC((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyR2®s !    (cCsÍ|js0|jr,|jd||fIJndStjdd||fƒ}|sVdStjj|ƒ\}}tjj|ƒd}|t    jkr©t    jj
d|ƒnt |ƒ}|j j d|ƒ|S(Ns"** No definition for %s '%s' foundR&sWhere is %s %s declared?is
import %s
(R-R RR1RöR@RARRÇRRÎRÏRìR(RóR“R¶RAtfileRèRG((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRF¶s         c Cs_|\}}}}}t|ƒ}|jdjd|ƒr…|jdjd|ƒ\}}    }    |jrâ|jjd||fƒqân]|jrâ|jjd|ƒ|jjdt|ƒt|ƒfƒ|jjd|fƒn|jdjd||ƒ|dk}
|jƒx|D]} |j    | |
ƒqW|jƒx|D]} |j
| ƒqDWdS(NiRÃs    
%s = %s
s"
class %s(aetools.ComponentItem):
s    """%s - %s """
s    want = %r
RÄ( RÆR@R3R5RìRRÔR.RÕtcompilepropertytcompileelement( RóR
R²R¶RR¸R¹tpnamet    othernameRÞtis_application_classtproptelem((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRúÅs$ "         & 
 
 c    Cse|\}}}|dkrdSt|ƒ}|jdjd|ƒrŸ|jdjd|ƒ\}}}||krvdS|jr|jjd||fƒqn||jr|jjd|ƒ|jjdt|ƒt|dƒfƒ|jjd|fƒ|jjd    |dfƒn|jdjd||ƒ|ra|jra|jjd
||fƒndS( Nsc@#!iR's
_Prop_%s = _Prop_%s
s#class _Prop_%s(aetools.NProperty):
s    """%s - %s """
is    which = %r
s    want = %r
s%s = _Prop_%s()
(RÆR@R3R5RìRRÔR.(    RóRNRMR²R¶R«RKRLRÞ((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRIÛs$  "          *cCs6|\}}|jr2|jjd||fƒndS(Ns#        element %r as %s
(RìR(RóROR¶R·((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRJòs     c CsA|\}}}}}t|ƒ}|jdjd|ƒrñ|jdjd|ƒd|krñ|jrí|s¤t|ƒdks¤t|ƒdkrí|dddkrí|jrá|jd||jdjd|ƒd|fIJntd‚ndSg}g}    g}
xd|D]\} | \} } }| dkr;|
j|ƒn| dkrMq
nt| ƒ} |j| ƒq
Wg}xT|
D]L}|\}}}|jd|ƒ\}}}||kr¶qw|j|ƒqwW|jrí|jj    d||fƒnx‰|D]}|\}}|dkrqôn|jd|ƒ\}}}|sb|jru|jj    d    ||fƒquqô|    j||fƒqôW|j
ƒ|    j
ƒ|jr=|jj    d
|ƒx(|D] }|jj    d ||fƒq±W|jj    d ƒ|jj    d |ƒx.|    D]&\}}|jj    d||fƒqW|jj    d ƒndS(NiRÃisc@#!s#** Skip multiple %s of %s (code %r)sAbout to skip non-empty classsc@#^s%s._superclassnames = %r
s!# XXXX %s element %r not found!!
s%s._privpropdict = {
s    '%s' : _Prop_%s,
s}
s%s._privelemdict = {
s    '%s' : %s,
( RÆR@R3R5RìRR RxRRRÕ(RóR
R²R¶RR¸R¹tcnameRRtelistt superclassesRNRKtpcodeR«tsuperclassnamest
superclasstsuperIdt    superDescRÞtsuperclassnametfullyqualifiednameR<ROtecodeR·R$tntfulln((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRû÷sd #3    4                   
 
     cCs|\}}}t|ƒ}|jdjd||ƒ|jr{|jjd|ƒ|jjdt|ƒt|ƒfƒndS(NiR(sclass %s(aetools.NComparison):
s    """%s - %s """
(RÆR@R.RìRRÔ(RóR R²R¶tcommenttiname((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRü4s      cCsˆ|\}}dt|ƒ}|jrj|jjd|ƒx|D]}|j|ƒq@W|jjdƒn|jdjd||ƒ|S(Ns_Enum_%ss%s = {
s}
 
iR (RÆRìRtcompileenumeratorR@R.(RóR R¶R6R²R˜((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRý<s      cCs<|\}}}|jjdt|ƒ|t|ƒfƒdS(Ns    %r : %r,    # %s
(RìRRÆRÔ(RóR˜R²R¶R((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyR_GscCsŠ|jd|ƒ\}}}|sW|jrS|jjdt|ƒt|ƒfƒndS|r†|jr†|jjd||fƒq†ndS(s<This enum code is used by an event. Make sure it's availableR s+_Enum_%s = None # XXXX enum %s not found!!
Nsfrom %s import %s
(R5RìRRÆRÔ(RóR R²R`R<((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRÿKs    )    cCså|js dS|jjdƒ|jjdƒ|jdjdƒ}|jƒx.|D]&\}}|jjd||fƒqTW|jjdƒ|jjdƒ|jdjdƒ}|jƒx.|D]&\}}|jjd    ||fƒqÅW|jjdƒ|jjd
ƒ|jdjd ƒ}|jƒx.|D]&\}}|jjd||fƒq6W|jjdƒ|jjd ƒ|jdjd ƒ}|jƒx.|D]&\}}|jjd||fƒq§W|jjdƒdS(Ns0
#
# Indices of types declared in this module
#
s_classdeclarations = {
iRÃs     %r : %s,
s}
s
_propdeclarations = {
R's    %r : _Prop_%s,
s
_compdeclarations = {
R(s
_enumdeclarations = {
R (RìRR@RÖRÕ(Rót    classlistRîRïtproplisttcomplisttenumlist((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRVs6    
 
 
 
N(RR%RRôRR5R2RFRúRERIRJRûRüRýR_RÿR(((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRùzs                              =                 cCs&|\}}}d||t|ƒfS(Ns %r -- %r %s(tcompiledataflags(R\R“R¥R±((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyt compiledatawscCs|ddkS(Nitnull((R\((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyR{scCs |dd@S(Nii€((R\((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyR~scCs |dd@S(Nii ((R\((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRscCsJ|\}}}|rt|ƒS|dkr/dS|dkr?dSd|fS(Ns****tanythingsobj san AE object referencesundocumented, typecode %r(RÔ(R\R“tdescrR±((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyR„s
  toptionaliR¨iR i tmutablei cCsxg}x^tdƒD]P}|d|>@r|tjƒkrM|jt|ƒqc|jt|ƒƒqqWdtj|ƒS(Niis[%s](RXt dataflagdictRþRRZRRC(R±tbitsRd((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRdscCs“t|ƒtdƒkr%tt|ƒSd}xa|D]Y}|d    ksfd|koatdƒknrs||}q2|ddt|ƒ}q2W|S(
s9Return a string with all non-ascii characters hex-encodedR-s    s
s t is\sx%02.2x(s    s
s (R“R–RÔtchrR›(RštrvRœ((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRԙs  . cCs§|s
dSd}tjd}|tj}xZ|D]R}||krP||}n-|dkri|d}n|dt|ƒ}|}q1Wtj|ƒr£|d}n|S(s§Turn any string into an identifier:
    - replace space by _
    - replace other illegal chars by _xx_ (hex code)
    - append _ if the result is a python keyword
    tempty_ae_name_R-t_Rms_%02.2x_(Rt ascii_letterstdigitsR›R³t    iskeyword(RšRotoktok2Rœ((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyRÆ¥s       
 t__main__i(Mt__doc__twarningsRR5R1R@RRR”RŠR³RKRktdistutils.sysconfigt    distutilsRht
Carbon.Rest Carbon.FolderR.RRFRARát__file__t_MAC_LIB_FOLDERRCRÍt    sysconfigtget_python_libRËRR$RR3RRRRjR_R^R]RRR R¡R¢R¤RžR©R¬R‹tgetdatat getargumenttgeteventt getpropertyt
getelementtgetclasst getcomparisont getenumeratortgetenumerationtgetsuiteRŒRmRÐR&RùReRRRRRkRdRÔRÆRR(((s_/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/gensuitemodule.pyt<module>sØ            
            3    &     '                                                                                                                                                                      wÿ@ý                    
"