Ñò ©7ãLc @s6dZddkZddkZddkZddkZddkZddkZddkZddkZ d„Z d„Z d„Z d„Z d„Zd„Zd „Zd „Zd „Zd „Zd „ZdZgaeiƒad„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z!dS(sj Windows has a specific implementation for most of these. For the group and user id-related (credential) APIs, no implementation is provided. This causes the file and directory actions to not utilize any credential metadata when acting on Windows-compatible systems. In the future, this may be able to be mapped onto the NTFS group mechanism if deemed useful. iÿÿÿÿNcCsdgS(s TODO: Detect Windows 64-bitti386((((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pyt get_isainfo,scCs tiƒS(N(tos_utiltget_os_release(((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pyt get_release0scCsdS(s. TODO: any other windows platforms to support?ti86pc((((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pyt get_platform3scCsdS(s+group names/numbers are ignored on Windows.iÿÿÿÿ((tnametdirpathtuse_file((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pytget_group_by_name7scCsdS(s+group names/numbers are ignored on Windows.iÿÿÿÿ((RRR ((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pytget_user_by_name;scCsdS(s+group names/numbers are ignored on Windows.t((tgidRR ((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pytget_name_by_gid?scCsdS(s+group names/numbers are ignored on Windows.R ((tuidRR ((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pytget_name_by_uidCscCsdS(s+group names/numbers are ignored on Windows.iÿÿÿÿ((((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pyt get_useridGscCsYytiƒSWnDtj o8yddk}|iƒSWqUtj odSXnXdS(Niÿÿÿÿ(tgetpasstgetusert ImportErrortwin32apit GetUserNametNone(R((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pyt get_usernameKs cCsAy&ddk}|iiiƒdjSWntj otSXdS(Niÿÿÿÿi(tctypestwindlltshell32t IsUserAnAdminRtFalse(R((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pytis_adminWs  cCsdS(su group names/numbers are ignored on Windows, so changing ownership of a file makes no sense. N((tpathtownertgroup((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pytchown_sttrashcCsïddkii}ddkl}z»tiƒx)tD]!\}}|i|ƒo|Sq6Wy%|i t i i |ƒdt ƒ}Wn|j odSXt i i|itƒ}ti|tƒti|iƒ|fƒ|SWdtiƒXdS(s& Use path to determine the trash directory. This method does not create the directory. If path is not contained within an image, return None. The directories for the images that have already been accessed are cached to improve the speed of this method. iÿÿÿÿN(tImageNotFoundExceptiontallow_ondisk_upgrade(tpkg.client.imagetclienttimagetpkg.client.api_errorsR$t cache_locktacquiretcached_image_infot startswithtImagetosRtdirnameRRtjointimgdirt trashnametshutiltrmtreetTruetappendtget_roottrelease(RR(R$tiroottitrashtimgttrashdir((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pyt get_trashdirŠs$     cCs}t|ƒ}|pdStii|ƒpti|ƒntid|ƒ}ti|tii|tii |ƒƒƒdS(sÙ Move the file to a trash folder within its containing image. If the file is not in an image, just return without moving it. If the file cannot be removed, raise an OSError exception. Ntdir( R>R/RtexiststmkdirttempfiletmkdtemptrenameR1tbasename(RR=ttdir((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pyt move_to_trashªs cCs‹yti||ƒWnptj od}|itijo‚nyti|ƒWntj ot|ƒnXti||ƒnXdS(sQ Rename the src file to the dst name, deleting dst if necessary. N(R/RDtOSErrorterrnotEEXISTtunlinkRG(tsrctdstterr((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pyRDºscCsQyti|ƒWn9tj o-}|itijo‚nt|ƒnXdS(s˜ Remove the given path. The file is moved to the trash area of the image if necessary where it will be removed at a later time. N(R/RKRHRItEACCESRG(RRN((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pytremoveÊs cCst||ƒdS(N(tcopyfile(RLRM((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pytlinkÖscCs#tii|ƒ}|didƒS(Nis\(R/Rt splitdrivetsplit(Rt drivepath((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pyt split_pathÙscCs>tii|ƒ}|ddjo tiiS|ddSdS(NiR s\(R/RRStsep(RRU((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pyR8Ýs cCsftiti|ƒiƒ}|ti@|ti@jo,td|||fƒ}||_|‚ndS(Ns%mode mismatch for %s, has %o, want %o(tstattS_IMODER/tlstattst_modetS_IRWXUtAssertionErrortmode(RR^tfmodetae((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pyt assert_modeäs  cCsti||ƒdS(N(R4RQ(RLRM((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pyRQís("t__doc__RR4R/RIRXRBt threadingtutilRRRRR R RRRRRR"R3R,tLockR*R>RGRDRPRRRVR8RaRQ(((s=/usr/lib/python2.6/vendor-packages/pkg/portable/os_windows.pyt!s>                  "