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
]\¬Qc @sdZddlmZedddƒddlZddlZyddlZddlZWn-dd$d„ƒYZd    d%d
„ƒYZnXd efd „ƒYZ    d Z
dZ dZ dZ dZdZdZdZd&Zdefd „ƒYZeed!„Zd"„Zed#kreƒndS('s%Routines to decode AppleSingle files
iÿÿÿÿ(twarnpy3ks*In 3.x, the applesingle module is removed.t
stackleveliNtMacOScBseZd„ZeeƒZRS(cCst|d|ƒS(Ns.rsrc(topen(tpathtmode((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/applesingle.pytopenrfs(t__name__t
__module__Rt classmethod(((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/applesingle.pyR s    tCarboncBseZddd„ƒYZRS(tFilecBsAeZddd„ƒYZddd„ƒYZddd„ƒYZRS(    tFSSpeccBseZRS((RR(((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/applesingle.pyR stFSRefcBseZRS((RR(((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/applesingle.pyR stAliascBseZRS((RR(((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/applesingle.pyRs((((RRR R R(((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/applesingle.pyR s((RRR (((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/applesingle.pyR
stErrorcBseZRS((RR(((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/applesingle.pyRss>LL16shiiis>llli iiiiiii    i
i i iit AppleSinglecBs,eZdZdZed„Zed„ZRS(cCs|jtƒ}y"tjt|ƒ\}}}}Wn#tk
rV}td|f‚nX|r„d|fGHd|fGHd|fGHn|tkr£td|f‚n|tkrÂtd|f‚n|dkrÚtd‚ngt    |ƒD]}    |jt
ƒ^qç}
g|_ xþ|
D]ö} ytjt | ƒ\} } }Wn#tk
r\}td    |f‚nX|rxd
| | |fGHn|j | ƒ|j|ƒ}t|ƒ|krÂtd |t|ƒf‚n|j j| |fƒ| tkrð||_q| tkr||_qqWdS( NsUnpack header error: %ssMagic:   0x%8.8xsVersion: 0x%8.8xs Entries: %ds(Unknown AppleSingle magic number 0x%8.8xs*Unknown AppleSingle version number 0x%8.8xis"AppleSingle file contains no forkssUnpack entry error: %ssFork %d, offset %d, length %ds$Short read: expected %d bytes got %d(treadtAS_HEADER_LENGTHtstructtunpacktAS_HEADER_FORMATt
ValueErrorRtAS_MAGICt
AS_VERSIONtxrangetAS_ENTRY_LENGTHtforkstAS_ENTRY_FORMATtseektlentappendt AS_DATAFORKtdataforktAS_RESOURCEFORKt resourcefork(tselftfileobjtverbosetheadertmagictversiontigtnentrytargtitheadersthdrtrestypetoffsettlengthtdata((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/applesingle.pyt__init__3sB"      (         cCs    t|dƒ}t}|rb|jdkr6td‚nt|dƒ}|j|jƒ|jƒn£|jdkrŒ|jdkrŒtd‚ny|jdk    rÇt|dƒ}|j|jƒ|jƒn|jdk    rtj    |dƒ}|j|jƒ|jƒndS(NtwbsNo resource fork foundsNo useful forks founds*wb(
RtFalseR#tNoneRtwritetcloseR!RR(R$RtresonlytoutfileR3tfp((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/applesingle.pyttofileVs$    N(RRR7R!R#R6R4R=(((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/applesingle.pyR/s #cCsÛt|dƒs²t|tjjƒr7|jƒd}nttjdƒr|t|tjjtjjfƒr |jƒ}q n$t|tjjƒr |jƒ}nt    |dƒ}nt
|d|ƒ}|j |d|ƒdS(sëdecode(infile, outpath [, resonly=False, verbose=False])
 
    Creates a decoded file from an AppleSingle encoded file.
    If resonly is True, then it will create a regular file at
    outpath containing only the resource fork from infile.
    Otherwise it will create an AppleDouble file at outpath
    with the data and resource forks from infile.  On platforms
    without the MacOS module, it will create inpath and inpath+'.rsrc'
    with the data and resource forks respectively.
 
    RiR trbR&R:N( thasattrt
isinstanceR
R Rt ResolveAliasR R t as_pathnameRRR=(tinfiletoutpathR:R&tasfile((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/applesingle.pytdecodeks !cCs£ttjƒdks=tjddkrRttjƒdkrRdGHtjdƒntjddkrxt}tjd=nt}ttjdtjdd|ƒdS(Niis-ris6Usage: applesingle.py [-r] applesinglefile decodedfileiR:(RtsystargvtexittTrueR6RF(R:((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/applesingle.pyt_test†s= t__main__((( iiiiii    i
i i i ii(t__doc__twarningsRRRGRt Carbon.FileR
RRRRRRRRR R"t    AS_IGNOREtobjectRR6RFRKR(((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/plat-mac/applesingle.pyt<module>s2    <