
    njA                     ~    S 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  SSKJrJr  SSKJr   " S	 S
\5      rg)zHdistutils.command.build_py

Implements the Distutils 'build_py' command.    N)log)ClassVar   )Command)DistutilsFileErrorDistutilsOptionError)convert_pathc                   B   \ rS rSr% Sr/ SQr\\\\	\	\	4      \\\	\	S-  \	4      -     \
S'   SS/r\\\	      \
S'   S	S0r\\\	\	4      \
S
'   S rS!S jrS!S jrS rS rS!S jrS rS rS rS rS rS rS rS rS"S\S\\	   4S jjrS rS!S jrS!S jr S!S jr!S r"g)#build_py   z5"build" pure Python modules (copy to build directory)))z
build-lib=dzdirectory to "build" (copy) to)compileczcompile .py to .pyc)
no-compileNz!don't compile .py files [default])z	optimize=Ozlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0])forcefz2forcibly build everything (ignore file timestamps)Nuser_optionsr   r   boolean_optionsr   negative_optc                 t    S U l         S U l        S U l        S U l        S U l        SU l        SU l        S U l        g )NFr   )	build_lib
py_modulespackagepackage_datapackage_dirr   optimizer   selfs    b/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/setuptools/_distutils/command/build_py.pyinitialize_optionsbuild_py.initialize_options(   s<     
    returnc                    U R                  SSS5        U R                  R                  U l        U R                  R                  U l        U R                  R                  U l        0 U l        U R                  R
                  (       aE  U R                  R
                  R                  5        H  u  p[        U5      U R
                  U'   M     U R                  5       U l	        [        U R                  [        5      (       d8   [        U R                  5      U l        SU R                  s=::  a  S::  d   e   eg g ! [        [        4 a    [        S5      ef = f)Nbuild)r   r   )r   r   r   r   zoptimize must be 0, 1, or 2)set_undefined_optionsdistributionpackagesr   r   r   itemsr	   get_data_files
data_files
isinstancer   int
ValueErrorAssertionErrorr   )r   namepaths      r    finalize_optionsbuild_py.finalize_options2   s"   ""/1C	
 ))22++66 --::(("//;;AAC
)5d);  & D--/ $----J #DMM 2DMM.Q..... . / J*+HIIJs   6D9 9Ec                     U R                   (       a  U R                  5         U R                  (       a   U R                  5         U R	                  5         U R                  U R                  SS95        g )NF)include_bytecode)r   build_modulesr)   build_packagesbuild_package_databyte_compileget_outputsr   s    r    runbuild_py.runK   sR    , ?? ==!##%$**E*BCr#   c                    / nU R                   (       d  U$ U R                    H  nU R                  U5      n[        R                  R                  " U R
                  /UR                  S5      -   6 nSnU(       a  [        U5      S-   nU R                  X#5       Vs/ s H  ofUS PM	     nnUR                  X#XG45        M     U$ s  snf )z?Generate list of '(package,src_dir,build_dir,filenames)' tuples.r      N)
r)   get_package_dirosr2   joinr   splitlenfind_data_filesappend)r   datar   src_dir	build_dirplenfile	filenamess           r    r+   build_py.get_data_filesi   s    }}K}}G**73G '7'--:L'LNI D7|a' 261E1Eg1WX1Wde1WIXKK9@A %  Ys   Cc           	         U R                   R                  S/ 5      U R                   R                  U/ 5      -   n/ nU H  n[        R                  " [        R                  R                  [        R                  " U5      [        U5      5      5      nUR                  U Vs/ s H2  owU;  d  M
  [        R                  R                  U5      (       d  M0  UPM4     sn5        M     U$ s  snf )z6Return filenames for package's data files in 'src_dir' )
r   getglobrB   r2   rC   escaper	   extendisfile)r   r   rI   globsfilespatternfilelistfns           r    rF   build_py.find_data_files   s    !!%%b"-0A0A0E0Egr0RRGyyT[[1<3HIH LL%%r5RWW^^B=OX   s   !	C'
."C'
C'
c                 8   U R                    H  u  pp4U H~  n[        R                  R                  X55      nU R	                  [        R                  R                  U5      5        U R                  [        R                  R                  X%5      USS9  M     M     g)z$Copy data files into build directoryFpreserve_modeN)r,   rB   r2   rC   mkpathdirname	copy_file)r   _packagerI   rJ   rM   filenametargets          r    r9   build_py.build_package_data   sp    7;3Hy%i:BGGOOF34GGLL3V5   & 8Gr#   c                 L   UR                  S5      nU R                  (       d%  U(       a  [        R                  R                  " U6 $ g/ nU(       aN   U R                  SR	                  U5         nUR                  SU5        [        R                  R                  " U6 $ U R                  R                  S5      nUb  UR                  SU5        U(       a  [        R                  R                  " U6 $ g! [         a    UR                  SUS   5        US	  Of = fU(       a  M  N)zReturn the directory, relative to the top of the source
distribution, where package 'package' should be found
(at least according to the 'package_dir' option, if any).r?   rP   r   )rD   r   rB   r2   rC   insertKeyErrorrQ   )r   r   r2   tailpdirs        r    rA   build_py.get_package_dir   s     }}S!ww||T**D/++CHHTN;D
 KK4(77<<.. ##''+DAt$ww||T**)   !KK48,R! $s   C4 4"DDc                 v   US:w  af  [         R                  R                  U5      (       d  [        SU S35      e[         R                  R	                  U5      (       d  [        SU S35      eU(       aF  [         R                  R                  US5      n[         R                  R                  U5      (       a  U$ g )NrP   zpackage directory 'z' does not existzsupposed package directory 'z ' exists, but is not a directoryz__init__.py)rB   r2   existsr   isdirrC   rU   )r   r   r   init_pys       r    check_packagebuild_py.check_package   s    
 "77>>+..()+6FG  77==--(2;- @- -  ggll;>Gww~~g&& r#   c                 |    [         R                  R                  U5      (       d  [        R                  " SX!5        gg)Nz!file %s (for module %s) not foundFT)rB   r2   rU   r   warning)r   modulemodule_files      r    check_modulebuild_py.check_module   s*    ww~~k**KK;[Qr#   c                 L   U R                  X5        [        R                  " [        R                  R	                  [        R
                  " U5      S5      5      n/ n[        R                  R                  U R                  R                  5      nU H  n[        R                  R                  U5      nXu:w  aT  [        R                  R                  [        R                  R                  U5      5      S   nUR                  XU45        M{  U R                  SU 35        M     U$ )Nz*.pyr   z
excluding )rq   rR   rB   r2   rC   rS   abspathr(   script_namesplitextbasenamerG   debug_print)	r   r   r   module_filesmodulessetup_scriptr   abs_fru   s	            r    find_package_modulesbuild_py.find_package_modules   s    70yydkk+.F!OPwwt'8'8'D'DEAGGOOA&E$))"''*:*:1*=>qA34  :l^!<=  r#   c                    0 n/ nU R                    H  nUR                  S5      nSR                  USS 5      nUS   n X   u  pxU(       d2  U R                  XW5      n	US4X'   U	(       a  UR                  USU	45        [        R                  R                  XvS-   5      n
U R                  X:5      (       d  M  UR                  XVU
45        M     U$ ! [         a    U R	                  U5      nSn Nf = f)a  Finds individually-specified Python modules, ie. those listed by
module name in 'self.py_modules'.  Returns a list of tuples (package,
module_base, filename): 'package' is a tuple of the path through
package-space to the module; 'module_base' is the bare (no
packages, no dots) module name, and 'filename' is the path to the
".py" file (relative to the distribution root) that implements the
module.
r?   r   rg   Fr@   __init__.py)
r   rD   rC   ri   rA   rq   rG   rB   r2   rw   )r   r)   r   ru   r2   r   module_baser   checkedrp   rv   s              r    find_modulesbuild_py.find_modules   s       ooF<<$DhhtAbz*Gr(K )1):&
 ,,WB%0!$4!NNGZ#AB
 '',,{%4GHK$$V99NNG+>?1 &4 '   "227; s   CC10C1c                    / nU R                   (       a  UR                  U R                  5       5        U R                  (       aF  U R                   H6  nU R	                  U5      nU R                  X#5      nUR                  U5        M8     U$ )a  Compute the list of all modules that will be built, whether
they are specified one-module-at-a-time ('self.py_modules') or
by whole packages ('self.packages').  Return a list of tuples
(package, module, module_file), just like 'find_modules()' and
'find_package_modules()' do.)r   rT   r   r)   rA   r   )r   r   r   r   ms        r    find_all_modulesbuild_py.find_all_modules"  sm     ??NN4,,./===="227;--gCq! ) r#   c                 R    U R                  5        Vs/ s H  oS   PM	     sn$ s  snf )Nrg   )r   )r   ru   s     r    get_source_filesbuild_py.get_source_files2  s'    )-)>)>)@A)@vr
)@AAAs   $c                 h    U/[        U5      -   US-   /-   n[        R                  R                  " U6 $ )Nr   )listrB   r2   rC   )r   rJ   r   ru   outfile_paths        r    get_module_outfilebuild_py.get_module_outfile5  s1    !{T']2fun5EEww||\**r#   r6   c                    U R                  5       n/ nU H  u  pEnUR                  S5      nU R                  U R                  XE5      nUR	                  U5        U(       d  MM  U R
                  (       a-  UR	                  [        R                  R                  USS95        U R                  S:  d  M  UR	                  [        R                  R                  XpR                  S95        M     UU R                   VVV	V
Vs/ s H/  u  pHpU
  H"  n[        R                  R                  X5      PM$     M1     snn
n	nn-  nU$ s  snn
n	nnf )Nr?   rP   )optimizationr   )r   rD   r   r   rG   r   	importlibutilcache_from_sourcer   r,   rB   r2   rC   )r   r6   r   outputsr   ru   _module_filerc   rI   rJ   rM   s              r    r;   build_py.get_outputs9  s   '')-4)G\mmC(G..t~~wOHNN8$<<NN!88PR8S ==1$NN!88$== 9  .5  	:>//
:I6)% GGLL-% .:I
 	
 
s   ?6E c                 T   [        U[        5      (       a  UR                  S5      nO&[        U[        [        45      (       d  [        S5      eU R                  U R                  X15      n[        R                  R                  U5      nU R                  U5        U R                  X$SS9$ )Nr?   z:'package' must be a string (dot-separated), list, or tupleFr]   )r-   strrD   r   tuple	TypeErrorr   r   rB   r2   r`   r_   ra   )r   ru   rv   r   outfiledirs         r    build_modulebuild_py.build_moduleT  s    gs##mmC(GGdE]33L  ))$..'Jggoog&C~~k%~HHr#   c                 `    U R                  5       nU H  u  p#nU R                  X4U5        M     g )N)r   r   )r   r   r   ru   rv   s        r    r7   build_py.build_modulesd  s1    ##%,3(G[
 f7; -4r#   c                    U R                   c!  [        [        U 5      R                   S35      eU R                    HJ  nU R	                  U5      nU R                  X5      nU H  u  pEnX:X  d   eU R                  XVU5        M!     ML     g )Nz9.packages is None. Is the Distribution missing packages ?)r)   r   type__name__rA   r   r   )r   r   r   r   package_ru   rv   s          r    r8   build_py.build_packagesm  s    == :&&''`a  }}G ..w7K//EG 29-+***!!&w? 29 %r#   c                 n   [         R                  (       a  U R                  S5        g SSKJn  U R
                  nUS   [        R                  :w  a  U[        R                  -   nU R                  (       a  U" USU R                  US9  U R                  S:  a  U" UU R                  U R                  US9  g g )Nz%byte-compiling is disabled, skipping.r   )r:   rg   r   )r   r   prefix)sysdont_write_bytecodewarnr   r:   r   rB   sepr   r   r   )r   rW   r:   r   s       r    r:   build_py.byte_compile  s    ""II=>'":bff_F
 <<$**VL==1jj	 r#   )
r   r   r,   r   r   r   r   r   r)   r   )r$   N)T)#r   
__module____qualname____firstlineno__descriptionr   r   r   r   r   __annotations__r   r   dictr!   r3   r<   r+   rF   r9   rA   rq   rw   r   r   r   r   r   boolr;   r   r7   r8   r:   __static_attributes__ r#   r    r   r      s    KK	 (U3S=!"T%S4Z0D*E%FF " -6w+?OXd3i(?.:I-FL(4S>*FJ2D<,$L42h B+D DI 6I <@0r#   r   )__doc__rR   importlib.utilr   rB   r   distutils._logr   typingr   corer   errorsr   r   r   r	   r   r   r#   r    <module>r      s5   0   	 
    = Jw Jr#   