
    i                     "   S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
Jr  SSK
Jr  SSKJrJr  SSKJr  \R&                  (       a	  SSKJs  Jr  \R.                  " \5      rSr\R6                  (       a  \R8                  " \R:                  5      rS rS rSS	 jr SS
 jr!S r"S r#S r$SS jr%\%r&\%r'SS jr(S r)S r*S r+S r,S r-\R\                  (       a  S r/g\R6                  (       a  S r/g\R&                  (       a  S r/gS r/g)z1
Find external dependencies of binary libraries.
    N)compat)log)dylibutils)winutilsc                     SSK n U R                  5       nUR                  U R                  5       5        [        R
                  " [        R                  5      [        R
                  " [        R                  5      R                  5       [        R
                  " [        R                  5      [        R
                  " [        R                  5      R                  5       1nX Vs/ s H'  n[        R
                  " U5      R                  5       PM)     sn-  n[        5       nU HQ  nU(       d  M  [        R
                  " U5      nUR                  5       (       d  M9  X2;   a  M@  UR                  U5        MS     [        US SS9nU$ s  snf )aw  
Return list of paths that serve as prefixes for parent-directory preservation of collected binaries and/or
shared libraries. If a binary is collected from a location that starts with a path from this list, the relative
directory structure is preserved within the frozen application bundle; otherwise, the binary is collected to the
frozen application's top-level directory.
r   Nc                 ,    [        U R                  5      $ N)lenparents)xs    IC:\des-py\RoboSAPF\venv\Lib\site-packages\PyInstaller\depend\bindepend.py<lambda>>_get_paths_for_parent_directory_preservation.<locals>.<lambda>^   s    AII    T)keyreverse)sitegetsitepackagesappendgetusersitepackagespathlibPathsysbase_prefixresolveprefixsetis_diraddsorted)r   
orig_pathsexcluded_pathspathpathss        r   ,_get_paths_for_parent_directory_preservationr&   )   s   $ %%'Jd..01 	S__%S__%--/SZZ SZZ ((*	N JGJD7<<%--/JGGJEE||D!{{}}!		$  56EEL' Hs   ".Fc                 p    U H%  nX R                   ;   d  M  U R                  U5      s  $    U R                  $ r
   )r   relative_toname)src_filenameparent_dir_preservation_pathsparent_dir_preservation_paths      r   _select_destination_directoryr-   c   s:    (E$'+?+??++,HII )F r   c           
      
  ^^ [        5       n[        5       n[        5       n/ nU SS nU GH  u  pn
U
S:X  a  M  [        R                  " U	5      nX;   a  M,  UR	                  U5        [
        R                  SU	5        [        X5       GH  u  nm[
        R                  SUT5        T(       d  UR                  X45        M9  [        R                  " T5      (       d  [
        R                  ST5        Ml  [        R                  " T5      mTU;   a!  [
        R                  S[        T5      5        M  UR	                  T5        [        TU5      n[        R                  " U5      n[        R                  (       a  UR                   [        R                  " S5      :X  aj  ["        R$                  " T5      (       aO  TR                   R                   R                   R                   n[        R                  " TR'                  U5      5      n[
        R                  S[        T5      [        U5      5        UR                  [        U5      [        T5      S	45        [        R(                  (       a  GM  UR                   [        R                  " S5      :X  a  GM  [+        U4S
 jU 5       5      (       a"  [
        R                  S[        U5      5        GMI  [
        R                  S[        U5      5        UR                  [        UR,                  5      [        U5      S45        GM     GM     U VV	V
s0 s HL  u  poS:w  d  M  [.        R0                  R3                  [.        R0                  R5                  U	5      5      XU
4_MN     nn	nn
[        U VV	V
s/ s H  u  poS:X  d  M  UPM     sn
n	n5      nU GH  u  nn[        R                  " U5      (       d  M$  [.        R0                  R3                  [.        R0                  R5                  U5      5      nUR7                  US5      nUc6  [        R8                  " U5      (       d  M  [
        R;                  SUU5        M  [        R(                  (       a  M  [        R                  " US   5      n[        R                  " US   5      mUR                   [        R                  " S5      :X  a  GM  UU;   a  GM$  [+        U4S jU 5       5      (       a"  [
        R=                  S[        U5      5        GM`  [
        R=                  S[        U5      5        UR                  U[        U5      S45        UR	                  U5        GM     U$ s  sn
n	nf s  sn
n	nf )af  
Perform binary dependency analysis on the given TOC list of collected binaries, by recursively scanning each binary
for linked dependencies (shared library imports). Returns new TOC list that contains both original entries and their
binary dependencies.

Additional search paths for dependencies' full path resolution may be supplied via optional argument.
NSYMLINKzAnalyzing binary %rz2Processing dependency, name: %r, resolved path: %rz5Skipping dependency %r due to global exclusion rules.z/Skipping dependency %r due to prior processing..zCollecting dependency %r as %r.BINARYc              3   F   >#    U  H  nTR                  U5      v   M     g 7fr
   match).0patterndep_src_paths     r   	<genexpr>-binary_dependency_analysis.<locals>.<genexpr>   s!     ]@\W\''00@\   !zSkipping symbolic link from %r to top-level application directory due to source path matching one of symlink suppression path patterns.z@Adding symbolic link from %r to top-level application directory.z:Library not found: could not resolve %r, dependency of %r.r      c              3   F   >#    U  H  nTR                  U5      v   M     g 7fr
   r3   )r5   r6   dependency_src_paths     r   r8   r9      s"     bEa'&,,W55Ear:   zMissing dependency handling: skipping symbolic link from %r to top-level application directory due to source path matching one of symlink suppression path patterns.z]Missing dependency handling: adding symbolic link from %r to top-level application directory.)r&   r   r   r   r    loggerdebugget_importsr   r   include_librarystrr-   PurePathr   	is_darwinparentosxutilsis_framework_bundle_libr(   is_winanyr)   osr$   normcasebasenamegetwarn_missing_libwarninginfo)binariessearch_pathssymlink_suppression_patternsr+   processed_binariesprocessed_dependenciesmissing_dependencies
output_toc	dest_namesrc_nametypecodesrc_pathdep_namedep_dest_pathframework_parent_pathseen_binariesexisting_symlinksdependency_namereferring_binarydependency_basenamedependency_toc_entrydependency_dest_pathr7   r=   s                         @@r   binary_dependency_analysisrf   n   s    %Q$R!  U
  !J)3%	Xy  <<))x(*H5 '2(&I"HlLLMxYef  $++X,@A ((66TVbc"<<5L 55NPST`Pab"&&|4
 :,HefM#,,];M
 M$8$8G<L<LS<Q$Q33LAA,8,?,?,F,F,M,M,T,T)$+$4$4\5M5MNc5d$eMLL:C<MsS`Oabs=13|3DhOP }}%%)9)9#)>>]@\]]]<=@=O
 _aderast!!3}'9'9#:C<NPY"Z[w 'J *4^ .8-7)Iy;P 	V))(34yH6UU-7   JpJ+H9foZoYJpq-A))$$_55 !gg..rww/?/?/PQ,001DdK'))/::NNLo_o #*#3#34H4K#L "),,/CA/F"G#**g.>.>s.CC$(99 bEabbb\]`au]v  KKo() 2C8L4MyYZ!!"56g .Bj w qs   0U' AU'U."U.c                     [         R                  (       a:  [        U 5      R                  5       R	                  S5      (       a  / $ [        X5      $ [         R                  (       a  [        X5      $ [        X5      $ )a  
Analyze the given binary file (shared library or executable), and obtain the list of shared libraries it imports
(i.e., link-time dependencies).

Returns set of tuples (name, fullpath). The name component is the referenced name, and on macOS, may not be just
a base name. If the library's full path cannot be resolved, fullpath element is None.

Additional list of search paths may be specified via `search_paths`, to be used as a fall-back when the
platform-specific resolution mechanism fails to resolve a library fullpath.
z	.manifest)	r   rH   rB   lowerendswith_get_imports_pefilerD   _get_imports_macholib_get_imports_ldd)filenamerR   s     r   r@   r@     sX     }}x= ))+66I"8::			$X<<77r   c                    SSK n[        5       nUR                  U SS9nUR                  UR                  S   UR                  S   /SSS9  [        US/ 5       H/  nUR                  R                  S	5      nUR                  U5        M1     [        US
S5      nU(       ae  UR                   HU  nUR                  c  M  UR                  R                  S	5      n	U	R                  S5      S   n
UR                  U
S-   5        MW     UR                  5         [        R                  R                  U 5      /U=(       d    / -   nU Vs1 s H  o[!        X5      4iM     nnU$ s  snf )zg
Windows-specific helper for `get_imports`, which uses the `pefile` library to walk through PE header.
r   NT	fast_loadIMAGE_DIRECTORY_ENTRY_IMPORTIMAGE_DIRECTORY_ENTRY_EXPORT)directoriesforwarded_exports_onlyimport_dllnames_onlyDIRECTORY_ENTRY_IMPORTutf-8DIRECTORY_ENTRY_EXPORTr0   z.dll)pefiler   PEparse_data_directoriesDIRECTORY_ENTRYgetattrdlldecoder    symbols	forwardersplitcloserJ   r$   dirnameresolve_library_path)rm   rR   ry   outputpeentrydll_strexported_symbolssymbolr   r~   libs               r   rj   rj   *  sT    UF 
8t	,B""#AB""#AB
  $!   5r:))""7+

7 ; r#;TB&..F+",,33G<	ooc*1-

3<( / HHJ GGOOH-.,2D"ELHNO(;<FOM Ps   Ec                 r	   [        5       n[        R                  (       a  [        R                  " S5      nO[        R
                  (       a  [        R                  " S5      nOn[        R                  (       a  [        R                  " S5      nOB[        R                  (       a  [        R                  " S5      nO[        R                  " S5      n[        R                  " S[        R                  R                  U 5      /[        R                  [        R                  [        R                  SS9n/ nUR                  R!                  5        Hk  nU(       d  M  UR#                  S5      (       a  UR%                  S	5      (       a  M:  UR#                  S
5      (       a  MR  SU;   a  MZ  UR'                  U5        Mm     U(       a&  [(        R+                  SU SR-                  U5      5        UR.                  R!                  5        GH  nSnSnUR1                  U5      n	U	(       Ga  [        R                  (       a~  U	R3                  S5      n
U
(       a5  U
n[        R                  R5                  U5      U	R3                  S5      -   nGOU	R3                  S5      n[        R                  R5                  U5      nO[        R
                  (       a"  U	R3                  S5      U	R3                  S5      pOU	R3                  S5      U	R3                  S5      pU=(       d    [        R                  R5                  U5      n[        R                  (       a<  [        R6                  " S[        R                  R5                  U5      5      (       a  GM  USS S;   a  GM  [        R8                  (       a'  UR;                  5       R#                  S5      (       a  GM  [        R                  R=                  U5      (       d  SnORUR%                  S5      (       a9  UR?                  S5      n[A        U5      S:w  a  GM-  US   RC                  5       nSnOGMF  U(       d)  [E        [        R                  R5                  U5      U5      nU(       a  [        R                  RG                  U5      nURI                  Xx45        GM     U$ )z
Helper for `get_imports`, which uses `ldd` to analyze shared libraries. Used on Linux and other POSIX-like platforms
(with exception of macOS).
zR^\s*(((?P<libarchive>(.*\.a))(?P<objectmember>\(.*\)))|((?P<libshared>(.*\.so))))$z^\s+(.*)\s+=>\s+(.*)$z$^\s*(?:(.*?)\s+=>\s+)?(.*?)\s+\(.*\)z\s*(.*?)\s+=>\s+(.*?)\s+\(.*\)lddrw   )stdinstderrstdoutencodingzError relocating z symbol not foundz7ldd: warning: you do not have execution permission for znot a dynamic executablezldd warnings for %r:
%s
N
libarchiveobjectmember	libsharedr;      z'ld(64)?(-linux|-musl)?(-.+)?\.so(\..+)?
   )z
linux-gatez
linux-vdsoz/cygdrive/c/windows/systemz	not foundz=>r   )%r   r   is_aixrecompileis_hpuxis_solaris_linux
subprocessrunrJ   r$   realpathDEVNULLPIPEr   
splitlines
startswithri   r   r>   rO   joinr   searchgrouprL   	fullmatch	is_cygwinrh   existsr   r   strip%_resolve_library_path_in_search_pathsnormpathr    )rm   rR   r   LDD_PATTERNpldd_warningsliner)   r   mr   tokenss               r   rl   rl   Y  s[    UF }} jj!vw	
 jj!9:	 jj!9:	
 jj!HIjj!BC 		  *+  	A L##% __011dmmDW6X6X __VWW (4/D!% && 18TYY|=TU##%t$}}WW\2
 %C77++C0177>3JJD ''+.C77++C0DGGAJ
cGGAJ
c4rww//4?? ||$NPRPWPWP`P`adPeff CRy88 99;))*FGG 77>>#&&]];''ZZ%F6{a!9??$DC  7  &C ''""3'C 	

D;C &F Mr   c                 t  ^ ^^^^^^^ SSK Jm  SSKJm  SSKJm   SSK Jm  [        5       n[        R                  R                  [        R                  R                  T 5      5      n[        R                  R                  [        R                  5      n[        R                  R                  U5      nS mUU 4S jm[        R                   UUU4S	 j5       n[        R                   UU4S
 j5       nU" T 5      u  pX" U5      -  n	U	R#                  [        R                  R%                  [&        R(                  S5      5        [+        [,        R/                  U	5      5      n	UU4S jmU4S jn
U GH  nSnUR1                  S5      (       Ga  [        R                  R$                  " UR3                  [        R4                  5      SS 6 nU	 H  n[        R                  R%                  X5      nUR1                  S5      (       a
  U
" XU5      nOK[        R                  R7                  U5      (       d  [        R                  R%                  X?5        T" U5      nU(       d  M  [        R                  R9                  U5      (       d  M  Un  O+   O(UR1                  S5      (       a
  U
" XU5      nOT" U5      nU(       d)  [;        [        R                  R=                  U5      U5      nU(       a  [        R                  R?                  U5      nURA                  X45        GM     U$ ! [         a    Sm GNf = f)zt
macOS-specific helper for `get_imports`, which uses `macholib` to analyze library load commands in Mach-O headers.
r   )	dyld_find)LC_RPATH)MachO) _dyld_shared_cache_contains_pathNc                     [        5       nU R                   H.  nUR                  5        H  u  p4nUR                  U5        M     M0     U$ r
   )r   headerswalkRelocatablesr    )r   referenced_libsheaderidxr)   r   s         r   _get_referenced_libs3_get_imports_macholib.<locals>._get_referenced_libs  sD    %iiF"("9"9";3##C( #<   r   c                 |  > / nU R                    H  nUR                   H  nUS   R                  nUT:X  d  M  US   R                  S5      nUR	                  S5      nUR                  S5      (       a/  UR                  S5      (       d  [        R                  SUT5        M  UR                  U5        M     M     U$ )Nr   r   rw    @z@executable_pathz@loader_pathz<Unsupported rpath format %r found in binary %r - ignoring...)	r   commandscmdr   rstripr   r>   rO   r   )r   	run_pathsr   commandcmd_typerpathr   rm   s         r   _get_run_paths-_get_imports_macholib.<locals>._get_run_paths  s     	iiF!??
 #1:>>x'#AJ--g6E!LL0E '',,U5E5EFj5k5k'eglnvw $$U+ +  " r   c                 4   > T" U 5      nT" U5      T" U5      4$ r
    )rm   r   r   r   r   s     r   !get_run_paths_and_referenced_libs@_get_imports_macholib.<locals>.get_run_paths_and_referenced_libs  s#     (O#A&q(999r   c                     > T" T" U 5      5      $ r
   r   )rm   r   r   s    r   get_run_paths,_get_imports_macholib.<locals>.get_run_paths!  s     eHo..r   r   c                    > [         R                  R                  U 5      (       a9  Tb  T" U 5      (       a  U $ [         R                  R                  U 5      (       a  U $ g  T" U 5      $ ! [         a     g f = fr
   )rJ   r$   isabsisfile
ValueError)r   r   r   s    r   _resolve_using_path2_get_imports_macholib.<locals>._resolve_using_path=  sk     77==/;@`ad@e@e
ww~~c""
	S>! 		s    A( (
A54A5c                 4  > U R                  S5      (       a  U [        S5      S  n O$U R                  S5      (       a  U [        S5      S  n T" [        R                  R	                  X5      5      nUb  U$ T" [        R                  R	                  X 5      5      $ )Nz@loader_path/z@executable_path/)r   r   rJ   r$   r   )r   bin_pathpython_bin_pathresolved_libr   s       r   _resolve_using_loader_path9_get_imports_macholib.<locals>._resolve_using_loader_pathO  s     >>/**c/*+,C^^/00c-./0C +277<<+FG# #277<<#EFFr   z@rpathr;   r   )!macholib.dyldr   macholib.mach_or   macholib.MachOr   r   ImportErrorr   rJ   r$   r   r   r   
executable	functools	lru_cacher   r   r   r   listdictfromkeysr   r   sepr   r   r   rL   r   r    )rm   rR   r   r   
python_binr   r   r   r   r   r   referenced_libr   r   run_pathlib_pathr   r   r   r   r   r   r   s   `               @@@@@@@r   rk   rk     s    (($0B UF
 wwrww//9:H!!#..1Jggooj1O. : :
 / /
 "C8!LO z**I RWW\\&"4"4e<= T]]9-.I$G6 * $$X..'',, 4 4RVV <QR @AC &77<<6&&'KLL9(o^H 77==22X828<H8x 8 8#+L &" (()MNN9.Tcd2>B @  0L 77++L9L
 	

N12Y *\ MQ  0+/(0s   L' 'L76L7c                    [         R                  R                  U 5      (       a  U $ [        R                  (       a  [        U 5      nU(       a  U$ [        X5      $ [        R                  (       ak  [        X5      nU(       a  U$ [        R                  " SS5      R                  [         R                  5       Vs/ s H  o3(       d  M  UPM     nn[        X5      $ [        R                  R                  U 5      $ s  snf )aP  
Given a library name, attempt to resolve full path to that library. The search for library is done via
platform-specific mechanism and fall back to optionally-provided list of search paths. Returns None if library
cannot be resolved. If give library name is already an absolute path, the given path is returned without any
processing.
PATH )rJ   r$   r   r   is_unix_resolve_library_path_unixr   rH   getenvr   pathsepctypesutilfind_library)r)   rR   fullpathr$   win_search_pathss        r   r   r     s     
ww}}T~~-d3O4THH	8LO .4]]62-F-L-LRZZ-Xa-XT\`D-Xa4TLL{{''-- bs   :
C:C:c                    U=(       d    /  H  n[         R                  R                  X 5      n[         R                  R                  U5      (       d  MH  [        R
                  (       a#   [        R                  " U5      nU[        :w  a  M  [         R                  R                  U5      s  $    g! [         a     M  f = f)z_
Low-level helper for resolving given library name to full path in given list of search paths.
N)rJ   r$   r   r   r   rH   r   get_pe_file_machine_type	Exception_exe_machine_typer   )r)   rR   search_pathr   dll_machine_types        r   r   r     s     $)r)77<<2ww~~h'' ==#+#D#DX#N   #44ww)) *"   s   *B00
B>=B>c           	         [         R                  (       d   S5       eU R                  S5      (       d  SU ;   a  [        nO[        n[         R
                  (       a  [         R                  " SS5      nOD[         R                  (       a  [         R                  " SS5      nO[         R                  " SS5      nU" U [        SUR                  [        R                  5      5      5      nUca  [        R                  " 5         [        R                  R                  U 5      nU(       a&  [        R                   R#                  U5      (       d   eUGc  S	S
/n[         R$                  S:X  a  UR'                  SS/5        OUR'                  SS/5        [         R(                  S:X  a9  [         R$                  S:X  a  UR'                  S/5        OUR'                  S/5        [*        R,                  " S5      nU(       aO  [        R                   R/                  U5      nUR1                  [        R                   R3                  S
U5      5        O[4        R7                  S5        [        R                   R9                  S5      (       a  UR1                  S5        [         R
                  (       a  UR1                  S5        O[         R:                  (       a8  [         R$                  S:X  a  UR1                  S5        OMUR1                  S5        O;[         R<                  (       d  [         R>                  (       a  UR1                  S5        U" X5      nU$ )z
UNIX-specific helper for resolving library path.

Emulates the algorithm used by dlopen. `name` must include the prefix, e.g., ``libpython2.4.so``.
zCCurrent implementation for Unix only (Linux, Solaris, AIX, FreeBSD)z.soz.so.LIBPATHr   DYLD_LIBRARY_PATHLD_LIBRARY_PATHNz/libz/usr/lib32bitz/lib32z
/usr/lib32z/lib64z
/usr/lib64intelz/usr/lib/i386-linux-gnuz/usr/lib/x86_64-linux-gnumultiarchsubdirz!Multiarch directory not detected.z#/data/data/com.termux/files/usr/libz/opt/freeware/libz/usr/local/lib/hpux32z/usr/local/lib/hpux64z/usr/local/lib) r   r   ri   r   _which_libraryr   r   rD   filterr   rJ   r   r   load_ldconfig_cacheLDCONFIG_CACHErM   r$   r   architectureextendmachine	sysconfigget_config_varrL   r   r   r>   r?   isdirr   
is_freebsd
is_openbsd)r)   lib_search_funclpr   r%   arch_subdirs         r   r   r     sC    >>```>}}Uv~ @ ) }}]]9b)			]].3]],b1
$tRXXbjj-A B
CC {!!#""&&t,77>>#&&&& {$')LL(L12LL(L12>>W$""g-7899:;
  ../@A''**;7KLLj+>?LL<= 77==>??LL>?==LL,-^^""g-4545&"3"3LL)*d*Jr   c                 
   [        U 5      n[        [        R                  R                  U5       HP  n[        R
                  " U5       H3  nU" U5      (       d  M  [        R                  R                  X45      s  s  $    MR     g)a  
Search for a shared library in a list of directories.

Args:
    name:
        The library name including the `lib` prefix but excluding any `.so` suffix.
    dirs:
        An iterable of folders to search in.
Returns:
    The path to the library if found or None otherwise.

N)_library_matcherr  rJ   r$   r   listdirr   )r)   dirsmatcherr$   _paths        r   r
  r
  ,  sV     t$Grww~~t,ZZ%Eu~~ww||D00 & -r   c                 H    [         R                  " U S-   5      R                  $ )zn
Create a callable that matches libraries if **name** is a valid library prefix for input library full names.
z[0-9]*\.)r   r   r4   )r)   s    r   r  r  @  s     ::d[()///r   c                  L   [         R                  (       a#  SSKn U R                  [        R
                  5      $ [        R                  " S5      =(       d-    [         R                  =(       a    [        R                  " S5      nU(       a  [        R                  " S5      nO[         R                  (       a[  [        R                  SS u  p4[         R                  (       a  SOSn[         R                  (       a  S	U S
U U S3nO7S	U S
U U S3nO+SSKJn  [         R                  (       a  SOSnU" SU S
35      e[         R                  (       d  [         R                  (       a8  [        R                   R#                  U5      R%                  S5      (       a  USS n[        R                   R#                  [        R                   R'                  U5      5      nU(       am  [)        [         R*                  5      n	U	 HN  u  pUc  M
  [        R                   R#                  [        R                   R'                  U5      5      U:X  d  ML  Us  $    S nU" U[         R,                  [        R                   R/                  [         R,                  S5      5      nU(       a  U$ [1        U5      nU(       a  U$ SSKJn  SU< S3n[         R2                  (       aJ  [        R                   R5                  S5      (       a&  S[        R                  R6                   3nUSU S3-  nU" U5      e)a  
Find Python shared library that belongs to the current interpreter.

Return  full path to Python dynamic library or None when not found.

PyInstaller needs to collect the Python shared library, so that bootloader can load it, import Python C API
symbols, and use them to set up the embedded Python interpreter.

The name of the shared library is typically fixed (`python3.X.dll` on Windows, libpython3.X.so on Unix systems,
and `libpython3.X.dylib` on macOS for shared library builds and `Python.framework/Python` for framework build).
Its location can usually be inferred from the Python interpreter executable, when the latter is dynamically
linked against the shared library.

However, some situations require extra handling due to various quirks; for example, Debian-based linux
distributions statically link the Python interpreter executable against the Python library, while also providing
a shared library variant for external users.
r   NPy_ENABLE_SHAREDPYTHONFRAMEWORK
INSTSONAMEr   tr   	libpythonr0   z.dylibz.so.1.0)PythonLibraryNotFoundErrorz?either the `--enable-shared` or the `--enable-framework` optionzthe `--enable-shared` optionz~Python was built without a shared library, which is required by PyInstaller. If you built Python from source, rebuild it with z.dll.ac                 .   U H  n[         R                  R                  X 5      n[         R                  R                  U5      (       d  MH  [         R                  R	                  U5      n[         R                  R                  U5      (       d  M  Us  $    g r
   )rJ   r$   r   r   r   )r)   libdirslibdir	full_paths       r   _find_lib_in_libdirs5get_python_library_path.<locals>._find_lib_in_libdirs  sk    FV2I77>>),, ((3I77>>),,  r   r   zERROR: Python shared library (z) was not found!z/etc/debian_versionzlibpython3.zw If you are using system python on Debian/Ubuntu, you might need to install a separate package by running `apt install z`.)r   rH   _winapiGetModuleFileNamer   	dllhandler  r  rD   is_condaversion_infois_nogilPyInstaller.exceptionsr&  r   rJ   r$   rK   ri   rL   r@   python_executabler   r   r   r   r   minor)r.  	is_sharedexpected_namepy_majorpy_minor	py_suffixr&  
option_strexpected_basenameimported_libraries_r   r,  python_libnamemessagepkg_names                   r   get_python_library_pathrC  J  s   , }}((77 	  !34 	K 
			Ii667HI  !00>	 !--bq1!??C	'z8*YKvNM (z8*YKwOM 	F  N%C 	 )@@J|1N
 	
 	))rww/?/?/N/W/WX`/a/a%cr* (()9)9-)HI
 ()A)AB-KAww 0 0 :;?PP ." *
V''/N
  **;<N B.}.??OPG277>>*?@@ !1!1!7!7 89$:R)	

 %W
--r   c                 b    [         R                  R                  U 5      (       d  g[        U 5      $ )a#  
Classify the given file as either BINARY or a DATA, using appropriate platform-specific method. Returns 'BINARY'
or 'DATA' string depending on the determined file type, or None if classification cannot be performed (non-existing
file, missing tool, and other errors during classification).
N)rJ   r$   r   _classify_binary_vs_datarm   s    r   classify_binary_vs_datarG    s'     77>>(## $H--r   c                 x    [        U S5       nUR                  S5      nS S S 5        WS:w  a  gSSU /n [        R                  " U[        R
                  [        R
                  [        R                  SS9nUR                  S	:X  a  S
$ S$ ! , (       d  f       Nq= f! [         a     g f = f! [         a     g f = f)Nrb   s   ELFDATAobjdumpz-autf8)r   r   r   r   r   r1   )openreadr   r   r   r   r   
returncode)rm   fpsigcmd_argsr   s        r   rE  rE    s    	h%ggaj &
 *
 tX.		!! ((A <<1,x8&8/ &% 		$  		s?   B BB AB, 
BB B 
B)(B),
B98B9c                 D   SS K n [        U S5       nUR                  S5      nS S S 5        WS:w  a  g UR	                  U SS9 n S S S 5        g! , (       d  f       N1= f! [         a     g f = f! , (       d  f       g= f! UR
                   a     g[         a     g f = f)	Nr   rI  r   s   MZrK  Tro   r1   )ry   rN  rO  r   rz   PEFormatError)rm   ry   rQ  rR  r   s        r   rE  rE    s    	h%ggaj &
 %<	8t4 5 &% 		 54## 	 		sb   A  AA  B A0B 
AA  A   
A-,A-0
A>:B >B B	BBc                 d    SS K n UR                  R                  U 5      ng! [         a     gf = f)Nr   r1   rK  )r   r   r   )rm   macholibmachos      r   rE  rE  "  s6    	NN((2E 			s   " 
//c                     g r
   r   rF  s    r   rE  rE  1  s    r   )NNr
   )0__doc__ctypes.utilr   r   rJ   r   r   r   r  r   PyInstallerr   r   loggingPyInstaller.dependr   r   PyInstaller.utils.win32r   rD   PyInstaller.utils.osxosxrF   	getLogger__name__r>   r   rH   r   r5  r&   r-   rf   r@   rj   rl   rk   r   findLibraryfindSystemLibraryr   r   r
  r  rC  rG  r   rE  r   r   r   <module>rf     s     	  	 
    & + ,	,,			8	$ 	== 99&:R:RS
7taN8*,^JZrpH #( 0K\1(0H.\. 
??98 ]]2 r   