;iddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZddl mZddlmZmZmZmZmZddlmZddlmZddlmZerddlmZer ddlm cm!Z"ej#e$Z%d Z&d Z'd Z(d Z) ddZ*dZ+dZ,dZ-dZ.ddZ/dZ0ddZ1dZ2ddZ3dZ4dZ5dZ6ddZ7dS)N)compat)log)EXTENSION_SUFFIXESis_aix is_darwinis_winis_linuxCONF)InvalidSrcDestTupleError)misc) versioninfocL||krtd|dSdS)z/ Rebuild is required if values differ. Building because %s changedTF)loggerinfo) attr_name old_value new_value last_builds NC:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\PyInstaller/building/utils.py_check_guts_eqr/s.I 19===t 5c|D]<\}}}tj||krtd|dS=dS)z Rebuild is required if mtimes of files listed in old TOC are newer than last_build. Use this for calculated/analysed values read from cache. rTF)r mtimerr)rold_tocnew_tocr dest_namesrc_nametypecodes r_check_guts_toc_mtimer!9sW *1% 8X :h  * , , KK5x @ @ @44 - 5rcJt||||pt||||S)z Rebuild is required if either TOC content changed or mtimes of files listed in old TOC are newer than last_build. Use this for input parameters. )rr!)rrrrs r_check_guts_tocr#Fs2 )Wgz B B Gi':FFGrc|dkr|||fS||r|||fS|dtj}tj|dt vr\tj|}d|vsJ|tj|t|dz}|||fS)z Take a TOC entry (dest_name, src_name, typecode) and adjust the dest_name for EXTENSION to include the full library suffix. EXTENSION.N) endswithreplaceosseppathsplitextrbasenamelen)rrr base_names radd_suffix_to_extensionr1Ps ;(H,,##-(H,,!!#rv..I w ""1%-???G$$Y// )#### 0 0 : :3y>>?? KK h ((rFc ddlm} |s |s ts|S|pg}|rNtj|} |D]7} | | r t d|| d}n8|r8tr1tj |rt d|d}|r1tj |rt d|d}|s|rtrtj|} | d| jd} | d } | r t d |dx}}n3| rt d |dx}}~ ~ ~ |s |s ts|Sd t&jdt&jd }t+jd}t.j| dd|d|d||}|r t.j||}tr|rZt5j|d}t.j||}n t.j|d}|rt=|d5}t5j|}dddn #1swxYwYt.j||}n t.j|d}t/j |dt.j|d} tj!|}n6#tD$ri}Yn(tF$rt $dwxYwt.j%|}t.j||}tM|}||vr"|||kr|St/j'|t/j t.j(|dtSj*||t/j+|d|r>g}trdg}n tXrdg}dg||}t dd| t[j.|tZj/tZj0tZj1dd d!}t 2d"|j3n#tZj4$r]}d}tXr d#|j3vrd}|r=t $d$|d%t $d"|j3Yd}~n0d}~wtF$r t $d$|d%YnwxYw|r]d&}| d'}|r t.j||}gd(} tr| 5d)|g| |}t dd| t[j.|tZj/tZj0tZj1dd d!}t 2d*|j3n#tZj4$rG}t $d+|d%t $d*|j3Yd}~n0d}~wtF$r t $d,|d%YnwxYwtr tmj7|||-tqtjd.gd/tj|j9j:DR}!tmj;||!tmj<|||nd#tlj=$rYnStlj>$r!|rt 2d0|Yn%tF$r}td1|d2|d}~wwxYw|||<tj@|||S)3a Process the collected binary using strip or UPX (or both), and apply any platform-specific processing. On macOS, this rewrites the library paths in the headers, and (re-)signs the binary. On-disk cache is used to avoid processing the same binary with same options over and over. In addition to given arguments, this function also uses CONF['cachedir'] and CONF['upx_dir']. rr z8Disabling UPX for %s due to match in exclude pattern: %sFz Disabling UPX for %s due to CFG!z1Disabling UPX for %s due to it being a Qt plugin!r&z.hmacz.chkzADisabling UPX and/or strip for %s due to accompanying .hmac file!z@Disabling UPX and/or strip for %s due to accompanying .chk file!pyr'cachedirbincachedzutf-8adhocrbNzno-entitlementsTexist_okz index.datzIPyInstaller bincache may be corrupted; use pyinstaller --clean to fix it.iz-Sz-X32_64stripz Executing: %s ignore)stdinstdoutstderrcheckerrorsencodingzOutput from strip command: %sz0654-419zFailed to run strip on %r!)exc_infoupxupx_dir)z--compress-icons=0z--lzmaz-qz--strip-loadconfzOutput from upx command: %szFailed to upx strip on %r!zFailed to run upx on %r!) display_namez @loader_pathcg|]}dS)..).0levels r z,process_collected_binary..Es2n2n2nE42n2n2nrzCFile %s failed optional architecture validation - collecting as-is!zFailed to process binary !)APyInstaller.configr rpathlibPurePathmatchrrrrpefile_check_control_flow_guardr is_file_qt_pluginr Path with_namename with_suffixis_filesys version_infoplatform architecturer*r,joinhashlibsha256encode hexdigestopenreadmakedirsload_py_data_structFileNotFoundError Exceptionwarningnormcase_compute_file_digestremovedirnameshutilcopyfilechmodr subprocessrunDEVNULLPIPESTDOUTdebugr?CalledProcessErrorappendosxutilsbinary_to_target_archstrparentpartsset_dylib_dependency_paths sign_binaryInvalidBinaryErrorIncompatibleBinaryArchError SystemErrorsave_py_data_struct)"rr use_stripuse_upx upx_exclude target_archcodesign_identityentitlements_filestrict_arch_validationr src_pathupx_exclude_entry hmac_pathchk_pathpyverarch cache_dircsi_hashfpef_hashcache_index_file cache_index cached_id cached_name src_digest strip_optionscmdpe show_warningupx_exerF upx_options target_rpaths" rprocess_collected_binaryrksX $(''''' WY#K#H--!,   ~~/00  VX`bsttt 6kI(SS 6AAA4)(33 GRRR  *9 *( *<))&&'?8='?'?'?@@ ''//      ( KK[]e f f f"' 'Gii      ( KKZ\d e e e"' 'Gi i WY <!!$ ;c&6q&9 ; ;E  " "1 %D  Z89888858$88I9GLLK88 C  9~&7&>&>w&G&GHHH Y0B0B0D0DEEII Y88I  C'.. 4"!.33 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Y0A0A0C0CDDII Y0ABBIK D))))w||I{;;./?@@   bccc   ++I',,y)44K%h//JK Y/ / /  +K ,,t<<<<  OHk***H[%   $U  (!FMM  ('KM44 4 OSXXc]]333 U (!!( A LL918 D D D D, K K KL %*00$  K;[SWXXX?JJJ U U U NN7tN T T T T T U#Sy/  5gll7G44G     3   1 2 2 222k2 OSXXc]]333 S (!!( A LL7 B B B B, E E E NN7tN T T T NN918 D D D D D D D D S S S NN5{TN R R R R R SS S  *; RZ [ [ [ [ o2n2nWEUV_E`E`EgEm2n2n2noooL  / \ J J J  .?AR S S S S*    D3 j j j&  LL^`h i i i i i S S SJ+JJJKKQR R S(K -{;;; s'K::K>K>N$$ O2%O;AUW)$AV<<*W)(W)1A[ ] =\*] ] B_`=-,`= `=$`88`=ctj}t|d5tfddD]}|| dddn #1swxYwYt |S)Nr8c.dS)Ni@)rd)rsrz&_compute_file_digest..gs"'')"4"4rr)r_sha1rciterupdate bytearraydigest)filenamehasherchunkrs @rrkrkds \^^F h  !4444c:: ! !E MM%  !!!!!!!!!!!!!!!! V]]__ % %%s,AA"%A"cRddlm}d}|d|r'td||d|dz }|d|r'td||d|dz }|rt d|d zd S) z Check that path does not overlap with WORKPATH or SPECPATH (i.e., WORKPATH and SPECPATH may not start with path, which could be caused by a faulty hand-edited specfile). Raise SystemExit if there is overlap, return True otherwise rr workpathz;Specfile error: The output path "%s" contains WORKPATH (%s)r'specpathz;Specfile error: The output path "%s" contains SPECPATH (%s)z\ERROR: Please edit/recreate the specfile (%s) and set a different output name (e.g. "dist").specT)rOr startswithrerror SystemExit)r,r specerrs r_check_path_overlaprls('''''G J""4(( RTXZ^_iZjkkk1  J""4(( RTXZ^_iZjkkk1   j L     4rc:t|rtj|stj|r5 tj|n#t $rt|YnwxYwtj|ddSdS)zA Create a clean directory from the given directory name. Tr9N) rr*r,isdirisfilerlOSError_rmtreere)r,s r_make_clean_directoryrs4  ) 7==   "'.."6"6   $      D4(((((())sA$$B?Bcddlm}|drd}nCtjrt d|z}nt d|z|dkrH|dstdt d|tj |d St d ) zn Remove directory and all its contents, but only after user confirmation, or if the -y option is set. rr noconfirmyzXWARNING: The output directory "%s" and ALL ITS CONTENTS will be REMOVED! Continue? (y/N)zERROR: The output directory "%s" is not empty. Please remove all its contents or use the -y option (remove output directory without confirmation).zSOn your own risk, you can use the option `--noconfirm` to get rid of this question.zRemoving dir %sz User abortedN)rOr rZr?isattyinputrr;lowerprintrrrnrmtree)r,r choices rrrs(''''' K         fim m   79= >   ||~~$$K  i g h h h %t,,, d(((rc t}|D]\}}|st||fd|s t||fdtjdtj|rt||fdtj|drt||fd|r?tj|s tj||}tj|}tj |stj |r|g}d}ntj |}d}|std |d |D]S}tj |r| tjtj|tj|tj|ftj |rtj|D]n\}} } ||sJ|r>tj|tj|} n tj||} tjtj|| } | D]} tj|| }tj |ro| tjtj| | tj|fpU|S) a Convert the passed list of hook-style 2-tuples into a returned set of `TOC`-style 2-tuples. Elements of the passed list are 2-tuples `(source_dir_or_glob, target_dir)`. Elements of the returned set are 2-tuples `(target_file, source_file)`. For backwards compatibility, the order of elements in the former tuples are the reverse of the order of elements in the latter tuples! Parameters ---------- binaries_or_datas : list List of hook-style 2-tuples (e.g., the top-level `binaries` and `datas` attributes defined by hooks) whose: * The first element is either: * A glob matching only the absolute or relative paths of source non-Python data files. * The absolute or relative path of a source directory containing only source non-Python data files. * The second element is the relative path of the target directory into which these source files will be recursively copied. If the optional `workingdir` parameter is passed, source paths may be either absolute or relative; else, source paths _must_ be absolute. workingdir : str Optional absolute path of the directory to which all relative source paths in the `binaries_or_datas` parameter will be prepended by (and hence converted into absolute paths) _or_ `None` if these paths are to be preserved as relative. Defaults to `None`. Returns ---------- set Set of `TOC`-style 2-tuples whose: * First element is the absolute or relative path of a target file. * Second element is the absolute or relative path of the corresponding source file to be copied to this target file. zEmpty SRC is not allowed when adding binary and data files, as it would result in collection of the whole current working directory.z]Empty DEST_DIR is not allowed - to collect files into application's top-level directory, use r&z!DEST_DIR must be a relative path!rIzEDEST_DIR must not point outside of application's top-level directory!FTzERROR: Unable to find z# when adding binary and data files.)setr r*curdirr,isabsnormpathrr^rrglobraddr.walkrelpathrm)binaries_or_datas workingdir toc_datassrc_root_path_or_glob trg_root_dirsrc_root_pathswas_glob src_root_pathsrc_dirsrc_subdir_basenamessrc_file_basenamesrel_dirtrg_dirsrc_file_basenamesrc_files rformat_binaries_and_datasrsDI/@QQ+|% *& 53   *& 5"9"""  7== & & w*,A<+PRuvv v 7  L ) ) 4 4T : : *& 5W   Tbgmm,ABB T$&GLL=R$S$S !!# 0 01F G G 7>>/ 0 0 BGMMBW4X4X 34NHH!Y'<==NH tr6Krrrss s+" " Mw~~m,,!  G$$RW\\,@P@PQ^@_@_%`%`aaG$$]33}-- IKQ^I_I_EG13E#--m<<<<< J"$'//'27??=;Y;Y"Z"Z"$'//'="I"I g..rw||L'/R/RSSG-?)#%7<<9J#K#K7>>(33&MM " 0 0gGX1Y1Y Z Z\^\c\l\lmu\v\v+ 7" H rc*|dvr2td|d}t||d|}n\tj|\}}|}|dkrGtd|t|}tj |dd }ntd |t|d 5}| } d d d n #1swxYwYtj|\}}|std |d z } t| |d|}n*#t$rt d|wxYw|S)zz Get the code-object for a module. This is a simplifed non-performant version which circumvents __pycache__. )-NzCompiling namespace package %sz# execoptimize.pycz%Reading code object from .pyc file %sNz&Compiling python script/module file %sr8z-Appending .py to compiled entry-point name....pyzSytnax error while compiling %s)rrvcompiler*r,r-r_read_pyc_datamarshalloadsrcrd SyntaxErrorri) modnamerrtxt code_object_extpyc_datafsources rget_code_objectr,s;  5w???c8VhGGG !!(++3iikk &== LL@( K K K%h//H!- 66KK LLA8 L L Lh%% " " " " " " " " " " " " " " " "W%%h//FAs " LMMME! %fhRRR    @(KKK  s%DD  D E))'Fctjtdz}td|Dtd}Yt j|j}|D]0}||r|t |dn1|St|tfd|j D}| |S)Npathexc3VK|]$}tj|dV%dS)N)r*r,r^)rKrs r z&strip_paths_in_code..bs2GGABGLLB//GGGGGGrT)keyreversec3\K|]&}t|rt|n|V'dSN) isinstancestrip_paths_in_code)rKconst_co code_func new_filenames rrz&strip_paths_in_code..psX 8B(I7V7VdHl333\dr) co_consts co_filename) rZr,r sortedr/r*rrrtypetuplerr))cor replace_pathsoriginal_filenamerconstsrs ` @rrr^sHtH~-MGGGGGSZ^___MG,,R^<<  A ++A.. 0Q9   IRI  F ::L: A AArc|d}|drdS|d}tj|drdS|ds|dsdS|D]}tj||rdSdS) ak Return True if the given binary_tuple describes a system binary that should be included. Exclude all system library binaries other than those with "lib-dynload" in the destination or "python" in the source, except for those matching the patterns in the exceptions list. Intended to be used from the Analysis exclude_system_libraries method. rz lib-dynloadTr'z*python*z/libz/usr/libF)rfnmatch) binary_tuple exceptionsdestsrc exceptions r_should_include_system_binaryrxs ?D }%%t q/CsJ''t >>& ! !#..*D*Dt ?4 + + 44  5rc|d}d|vr|}d}n|dd}|d}tjj|g||dzR}|r||dnd} | tj|\} } | } | dkrPt|d5} | } dddn #1swxYwYt| |d| } nH| dkr,t|}tj |d d} ntd |d | d t| } tj5}|t$j|t)jdd|dtj| ||}dddn #1swxYwYtj|rDt|d5}|}dddn #1swxYwY||kr|Stjtj|dt|d5}||dddn #1swxYwY|S)a Given the name and source file for a pure-python module, compile the module in the specified working directory, and return the name of resulting .pyc file. The paths in the resulting .pyc module are anonymized by having their absolute prefix removed. If a .pyc file with matching name already exists in the target working directory, it is re-used (provided it has compatible bytecode magic in the header, and that its modification time is newer than that of the source file). If the specified module is available in binary-only form, the input .pyc file is copied to the target working directory and post-processed. If the specified module is available in source form, it is compiled only if corresponding code object is not available in the optional code-object cache; otherwise, it is copied from cache and post-processed. When compiling the module, the specified byte-code optimization level is used. It is up to caller to ensure that the optional code-object cache contains only code-objects of target optimization level, and that if the specified working directory already contains .pyc files, that they were created with target optimization level. r&__init__Nrrr8rrrzInvalid python module file z; unhandled extension rNtj|}|r|}nt j|}|t j|rwt j|d5}t| | }| |}dddn #1swxYwYntd|d|ddtjkrt!d|d|S)z Helper for reading data from .pyc files. Supports both stand-alone and archive-embedded .pyc files. Used by `compile_pymodule` and `get_code_object` helper functions. NrzCannot find .pyc file rNzThe .pyc module z1 was compiled for incompatible version of python!)rPrUrY read_bytesr path_to_parent_archivezipfile is_zipfileZipFiler{ relative_toas_posixrdrgrr r)rrrparent_zip_file zip_archivezip_entry_names rrrsU |H%%Hm&&((5h??  &7+=o+N+N &#66 <+!$X%9%9/%J%J%S%S%U%U!V!V&++N;; < < < < < < < < < < < < < < < $$JX$J$J$JKK K BQB<60 0 0kkkkll l Os=A CCCc~hd}g}|D]\}}}tj|}tj|}|jtjdkrP|jj|vr0tj|jj|z }t |}||||f|S)z Process the given `binaries` TOC list to apply work around for `pywin32` package, fixing the target directory for collected extensions. >win32 pythonwinpywin32_system32r&)rPrQr|rWrr{rx)binariesPYWIN32_SUBDIRSprocessed_binariesrrr dest_pathrs r postprocess_binaries_toc_pywin32rDsA@@O)1CC% 8X$Y// #H--  w/44 4 49M9S9S9U9UYh9h9h()=>>JIII!!9h"ABBBB rcdtjdtjdddtjdtjddh}tjdtjdh}g}|D]\}}}tj|}|j|vr4|j|vr+tjd|jz }t|}||||f|S) z Process the given `binaries` TOC list to apply work around for Anaconda `pywin32` package, fixing the location of collected `pywintypes3X.dll` and `pythoncom3X.dll`. pywintypesrr'z.dll pythoncomr&r=r?) rZr[rPrQrWrr|r{rx)r@DLL_CANDIDATESDUPLICATE_DIRSrBrrr rCs r)postprocess_binaries_toc_pywin32_anacondarJs DS%a(C#*:1*=CCCBC$Q'B)9!)<BBBN !!N )1CC% 8X$Y// >   ! !^ 3 3 8HN8Z8Z();<>$3M3MD|+,AQOOPXY &tX LLL S"&11IG,,RW-=-=h-G-GHHMHc:%%RVj00  I 1.///T400111$$$*400 T2&&&y11 D"++--000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1111111111111111111s7CG )B=F2& G 2F6 6G 9F6 :G  GG)FFNNNNFr)8r rr_rrr*rPr\rnr!rqrZr4 PyInstallerrrloggingPyInstaller.compatrrrrr rOr PyInstaller.exceptionsr PyInstaller.utilsr PyInstaller.utils.win32rPyInstaller.utils.osxutilsosxry getLogger__name__rrr!r#r1rrkrrrrrrrr.rrDrJrVrJrrrbs     &&&&&&VVVVVVVVVVVVVV######;;;;;;"""""" 4333333 -,,,,,,,,,  8 $ $   GGG)))<  vvvvr&&&. ) ) ))))Bwwwwt///dBBBB4,QQQQh:6###L111111r