
    vKg<                       S SK J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J	r	  S SK
J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KJr  S SKJs  Jr  S SKrS SKJr  Sr SS jr! " S S\R4                  5      rS r" " S S5      r#g)    )annotationsN)IterableIterator)partial)glob)Path)unique_everseen   )StrPathStrPathT)Distribution)SetuptoolsDeprecationWarning)convert_path)z*.pyizpy.typedc                    [         R                  " U [         R                  " U 5      R                  [        R                  -  5        g N)oschmodstatst_modeS_IWRITE)targets    [/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/setuptools/command/build_py.pymake_writabler      s'    HHVRWWV_,,t}}<=    c                  B  ^  \ rS rSr% SrS\S'   SrS\S'   SrS	\S
'   S r    S!             S"U 4S jjjr	S#S jr
S$S jrS rS rS rS rS%S&U 4S jjjrS'S jrS(S jrS(S jrS#S jrS#S jr      S)S jrS#S jrS rS rS rS r\S*S j5       rS rU =r$ )+build_py   aD  Enhanced 'build_py' command that includes data files with packages

The data files are specified via a 'package_data' argument to 'setup()'.
See 'setuptools.dist.Distribution' for more details.

Also, this version of the 'build_py' command allows you to specify both
'py_modules' and 'packages' in the same setup operation.
r   distributionFbooleditable_modeNzStrPath | Noneexisting_egg_info_dirc                    [         R                  R                  U 5        U R                  R                  U l        U R                  R
                  =(       d    0 U l        SU R                  ;   a  U R                  S	 g g )N
data_files)origr   finalize_optionsr   package_dataexclude_package_data__dict__selfs    r   r%   build_py.finalize_options,   s^    &&t, --::$($5$5$J$J$Pb!4==(l+ )r   c                   > U(       aD  [        [        U5      R                  5       5      n[        [        U5      R                  5       5      n[        TU ]  XX4XV5      $ r   )strr   resolvesuper	copy_file)r*   infileoutfilepreserve_modepreserve_timeslinklevel	__class__s          r   r0   build_py.copy_file3   sO     f--/0F$w-//12Gw ]D
 	
r   c                j   U R                   (       d  U R                  (       a  U R                  (       a  gU R                   (       a  U R                  5         U R                  (       a   U R	                  5         U R                  5         U R                  [        R                  R                  U SS95        g)z?Build modules, packages, and copy data files to build directoryNF)include_bytecode)

py_modulespackagesr    build_modulesbuild_packagesbuild_package_databyte_compiler$   r   get_outputsr)   s    r   runbuild_py.runD   sp    4==T5G5G?? ==!##% 	$--33D53QRr   c                    US:X  a!  U R                  5       U l        U R                  $ [        R                  R	                  X5      $ )zlazily compute data filesr#   )_get_data_filesr#   r$   r   __getattr__)r*   attrs     r   rF   build_py.__getattr__T   s9    <"224DO??"}}((44r   c                    U R                  5         [        [        U R                  U R                  =(       d    S5      5      $ )z?Generate list of '(package,src_dir,build_dir,filenames)' tuples )analyze_manifestlistmap_get_pkg_data_filesr<   r)   s    r   rE   build_py._get_data_files[   s/    C00$--2E2FGGr   c                    U R                   R                  S0 5        [        [        U R                  U R
                  =(       d    S5      5      $ )z
Generate list of ``(package,src_dir,build_dir,filenames)`` tuples,
but without triggering any attempt to analyze or build the manifest.
manifest_filesrJ   )r(   
setdefaultrL   rM   rN   r<   r)   s    r   get_data_files_without_manifest(build_py.get_data_files_without_manifest`   s:     	  !126C00$--2E2FGGr   c                $   U R                  U5      n[        R                  R                  " U R                  /UR                  S5      -   6 nU R                  X5       Vs/ sH"  n[        R                  R                  XB5      PM$     nnXX54$ s  snf N.)get_package_dirr   pathjoin	build_libsplitfind_data_filesrelpath)r*   packagesrc_dir	build_dirfile	filenamess         r   rN   build_py._get_pkg_data_filesj   s    &&w/ GGLLDNN#3gmmC6H#HJ	
 ,,W>
> GGOOD*> 	 
 55	
s   (Bc                ~   U R                  U R                  UU[        S9n[        [	        [
        SS9U5      n[        R                  R                  U5      n[        [        R                  R                  U5      n[        R                  " U R                  R                  U/ 5      U5      nU R                  XU5      $ )z6Return filenames for package's data files in 'src_dir')extra_patternsT)	recursive)_get_platform_patternsr&   _IMPLICIT_DATA_FILESrM   r   r   	itertoolschainfrom_iterablefilterr   rY   isfilerQ   getexclude_data_files)r*   r_   r`   patternsglobs_expandedglobs_matches
glob_filesfiless           r   r]   build_py.find_data_filesx   s    ../	 / 
 WTT:HE!55nEBGGNNM:
##GR0
 &&w??r   c                   > U R                   (       a'  [        U R                  5       R                  5       5      $ [        TU ]  U5      $ )1See :class:`setuptools.commands.build.SubCommand`)r    rL   get_output_mappingkeysr/   rA   )r*   r:   r7   s     r   rA   build_py.get_outputs   s:    //166899w"#344r   c                    [         R                  " U R                  5       U R                  5       5      n[	        [        US S95      $ )rx   c                    U S   $ )Nr   rJ   )xs    r   <lambda>-build_py.get_output_mapping.<locals>.<lambda>   s    !A$r   )key)rj   rk    _get_package_data_output_mapping_get_module_mappingdictsorted)r*   mappings     r   ry   build_py.get_output_mapping   s<    //113$$&
 F7788r   c              #     #    U R                  5        H8  u  pnUR                  S5      nU R                  U R                  X5      nXC4v   M:     g7f)z5Iterate over all modules producing (dest, src) pairs.rW   N)find_all_modulesr\   get_module_outfiler[   )r*   r_   modulemodule_filefilenames        r   r   build_py._get_module_mapping   sK     ,0,A,A,C(G[mmC(G..t~~wOH)) -Ds   AAc              #     #    U R                    HR  u  pp4U HF  n[        R                  R                  X55      n[        R                  R                  X%5      nXg4v   MH     MT     g7f)z6Iterate over package data producing (dest, src) pairs.N)r#   r   rY   rZ   )r*   r_   r`   ra   rc   r   r   srcfiles           r   r   )build_py._get_package_data_output_mapping   sP     6:oo2Gi%i:'',,w9'' & 7Fs   A$A&c                    U R                  5        HQ  u  pU R                  [        R                  R	                  U5      5        U R                  X!5      u  p4[        U5        MS     g)z$Copy data files into build directoryN)r   mkpathr   rY   dirnamer0   r   )r*   r   r   _outf_copieds        r   r?   build_py.build_package_data   sI    #DDFOFKK/0!^^G<NE&!  Gr   c                   0 U l         U R                  R                  (       d  g 0 nU R                  =(       d    S H  nX![	        U R                  U5      5      '   M!     U R                  (       a_  [        U R                  S5      R                  5       (       a6  U R                  n[        US5      nUR                  SS9R                  5       nODU R                  S5        U R                  S5      nUR                  nUR                  R                  n[!        5       nU R#                  XS5       GH  n[$        R&                  R)                  [	        U5      5      u  pS nU
nU	(       a_  X:w  aZ  X;  aU  U	n[$        R&                  R)                  U	5      u  p[$        R&                  R+                  X5      n
U	(       a  X:w  a  X;  a  MU  X;   d  M  X:X  a  UR-                  U
5      (       a  M  O,UR/                  X   U
5      nU(       a  UR1                  U5        U R                   R3                  X   / 5      R5                  U5        GM     g )NrJ   zSOURCES.txtzutf-8)encodingegg_info)rQ   r   include_package_datar<   assert_relativerX   r!   r   exists	read_text
splitlinesrun_commandget_finalized_commandr   filelistru   _IncludePackageDataAbuse_filter_build_filesr   rY   r\   rZ   	is_moduleimportable_subpackagewarnrR   append)r*   src_dirsr_   egg_info_dirmanifestru   ei_cmdcheckrY   dfprevoldfdf
importables                  r   rK   build_py.analyze_manifest   s   46  55#%}}**GGN_T%9%9'%BCD +
 &&T//?FFHH55LL-8H&&&8CCEEZ(//
;F!??LOO))E(*,,UAD77==!67DADD	a&7a(GGLL' 	a&7 }9q))  * "'!<!<X[!!LJ!

:.##..x{B?FFtL! Br   c              #    ^#    U R                  S5      nX R                  UR                  UR                  4nU Vs/ sH*  oU(       d  M  [        R
                  R                  U5      PM,     nnU Hf  n[        R
                  R                  U5      m[        R
                  R                  U5      (       a  [        U4S jU 5       5      (       d  Mb  Uv   Mh     gs  snf 7f)aM  
``build_meta`` may try to create egg_info outside of the project directory,
and this can be problematic for certain plugins (reported in issue #3500).

Extensions might also include between their sources files created on the
``build_lib`` and ``build_temp`` directories.

This function should filter this case of invalid files out.
buildc              3  *   >#    U H	  oT;  v   M     g 7fr   rJ   ).0r   	norm_paths     r   	<genexpr>/build_py._filter_build_files.<locals>.<genexpr>   s     -T)Qy.@)s   N)	r   r[   
build_temp
build_baser   rY   normpathisabsall)	r*   ru   r   r   
build_dirsp	norm_dirsrb   r   s	           @r   r   build_py._filter_build_files   s      **730@0@%BRBRS
2<B*Q(RWW%%a(*	BD((.I77==&&#-T)-T*T*T
  Cs   9C 	C	#C,A"C C c                    g r   rJ   r)   s    r   get_data_filesbuild_py.get_data_files   s    r   c                *    U R                   U   $ ! [         a     Of = f[        R                  R	                  XU5      nX0R                   U'   U(       a  U R
                  R                  (       d  U$ U R
                  R                   H#  nXA:X  d  UR                  US-   5      (       d  M#    O   U$ [        US5       nUR                  5       nSSS5        O! , (       d  f       O= fSW;  a$  [        R                  R                  SU< S35      eU$ )z8Check namespace packages' __init__ for declare_namespacerW   rbNs   declare_namespacezNamespace package problem: z is a namespace package, but its
__init__.py does not call declare_namespace()! Please fix it.
(See the setuptools manual under "Namespace Packages" for details.)
")packages_checkedKeyErrorr$   r   check_packager   namespace_packages
startswithopenread	distutilserrorsDistutilsError)r*   r_   package_dirinit_pypkgr   contentss          r   r   build_py.check_package   s    	((11 		 ----d[I)0g&d//BBN$$77C~#!>!> 8 N'4 AvvxH !  x/""11 <CE  s    
>C
C&c                l    0 U l         [        R                  R                  U 5        SU l        S U l        g )NF)r   r$   r   initialize_optionsr    r!   r)   s    r   r   build_py.initialize_options  s,     "((."%)"r   c                    [         R                  R                  X5      nU R                  R                  b4  [
        R                  R                  U R                  R                  U5      $ U$ r   )r$   r   rX   r   src_rootr   rY   rZ   )r*   r_   ress      r   rX   build_py.get_package_dir  sN    mm++D:%%177<< 1 1 : :C@@
r   c                  ^^ [        T5      mU R                  U R                  UU5      nU4S jU 5       n[        R                  R                  U5      n[        U5      mU4S jT 5       n[        [        U5      5      $ )z6Filter filenames for package's data files in 'src_dir'c              3  P   >#    U H  n[         R                  " TU5      v   M     g 7fr   )fnmatchrm   )r   patternru   s     r   r   .build_py.exclude_data_files.<locals>.<genexpr>!  s     Oh7ug66hs   #&c              3  4   >#    U H  oT;  d  M
  Uv   M     g 7fr   rJ   )r   fnbads     r   r   r   %  s     7"322s   	)rL   rh   r'   rj   rk   rl   setr	   )	r*   r_   r`   ru   rq   match_groupsmatcheskeepersr   s	      `    @r   rp   build_py.exclude_data_files  so    U..%%

 PhO////='l77OG,--r   c                   ^ [         R                  " UU R                  S/ 5      U R                  U/ 5      5      nU4S jU 5       $ )z
yield platform-specific path patterns (suitable for glob
or fn_match) from a glob-based spec (such as
self.package_data or self.exclude_package_data)
matching package in src_dir.
 c              3  t   >#    U H.  n[         R                  R                  T[        U5      5      v   M0     g 7fr   )r   rY   rZ   r   )r   r   r`   s     r   r   2build_py._get_platform_patterns.<locals>.<genexpr>6  s1      
 ( GGLL,w"788's   58)rj   rk   ro   )specr_   r`   rf   raw_patternss     `  r   rh   build_py._get_platform_patterns)  sF     !HHRHHWb!


 (
 	
r   )r#   r    r'   r!   rQ   r&   r   )TTN   )r1   r   r2   r   r3   r   r4   r   r5   z
str | Noner6   objectreturnztuple[StrPathT | str, bool]r   None)rG   r-   )T)r:   r   r   z	list[str])r   zdict[str, str])r   zIterator[tuple[str, str]])ru   zIterable[str]r   r   r   zIterator[str])rJ   ) __name__
__module____qualname____firstlineno____doc____annotations__r    r!   r%   r0   rB   rF   rE   rS   rN   r]   rA   ry   r   r   r?   rK   r   r   r   r   rX   rp   staticmethodrh   __static_attributes____classcell__)r7   s   @r   r   r      s    M4,0>0, ##

 
 	

 
 
 
 
%
 
"S 5H
H6@$5 59*("'MR".5	*<*.  
 
r   r   c                    [         R                  R                  U 5      (       d  U $ SSKJn  [
        R                  " S5      R                  5       U -  nU" U5      e)Nr   )DistutilsSetupErrorz
        Error: setup script specifies an absolute path:

            %s

        setup() arguments must *always* be /-separated paths relative to the
        setup.py directory, *never* absolute paths.
        )r   rY   r   distutils.errorsr  textwrapdedentlstrip)rY   r  msgs      r   r   r   =  sS    77==4 			
 &(

	  c
""r   c                  F    \ rS rSrSr " S S\5      rS rS rS r	S r
S	rg
)r   iR  z>Inform users that package or module is included as 'data file'c                      \ rS rSrSrSrSrg)!_IncludePackageDataAbuse._WarningiU  zU
        Package {importable!r} is absent from the `packages` configuration.
        a|  
        ############################
        # Package would be ignored #
        ############################
        Python recognizes {importable!r} as an importable package[^1],
        but it is absent from setuptools' `packages` configuration.

        This leads to an ambiguous overall configuration. If you want to distribute this
        package, please make sure that {importable!r} is explicitly added
        to the `packages` configuration field.

        Alternatively, you can also rely on setuptools' discovery methods
        (for example by using `find_namespace_packages(...)`/`find_namespace:`
        instead of `find_packages(...)`/`find:`).

        You can read more about "package discovery" on setuptools documentation page:

        - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

        If you don't want {importable!r} to be distributed and are
        already explicitly excluding {importable!r} via
        `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
        you can try to use `exclude_package_data`, or `include-package-data=False` in
        combination with a more fine grained `package-data` configuration.

        You can read more about "package data files" on setuptools documentation page:

        - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


        [^1]: For Python, any directory (with suitable naming) can be imported,
              even if it does not contain any `.py` files.
              On the other hand, currently there is no concept of package data
              directory, all directories are treated like packages.
        rJ   N)r   r   r   r   _SUMMARY_DETAILSr   rJ   r   r   _Warningr  U  s    "r   r  c                "    [        5       U l        g r   )r   _already_warnedr)   s    r   __init__!_IncludePackageDataAbuse.__init__  s    "ur   c                l    UR                  S5      =(       a    US [        S5      *  R                  5       $ )Nz.py)endswithlenisidentifier)r*   rb   s     r   r   "_IncludePackageDataAbuse.is_module  s,    }}U#J]E
{(;(H(H(JJr   c                    [        U5      R                  n[        [        R                  " [
        R                  UR                  5      5      nU(       a  SR                  U/UQ5      $ g rV   )	r   parentrL   rj   	takewhiler-   r  partsrZ   )r*   r  rb   r   r  s        r   r   ._IncludePackageDataAbuse.importable_subpackage  sO    4jY(()9)9399EF88V,e,--r   c                    XR                   ;  a5  U R                  R                  US9  U R                   R                  U5        g g )N)r   )r  r  emitadd)r*   r   s     r   r   _IncludePackageDataAbuse.warn  s<    111MM*5  $$Z0 2r   )r  N)r   r   r   r   r   r   r  r  r   r   r   r   rJ   r   r   r   r   R  s(    H'/ 'V%K1r   r   r   )$
__future__r   r   rj   r   r   r  collections.abcr   r   	functoolsr   r   pathlibr   more_itertoolsr	   _pathr   r   distr   warningsr   distutils.command.build_pycommandr   r$   r  r   distutils.utilr   ri   r   r   r   rJ   r   r   <module>r,     sh    "   	   .    * %  3 ) )  ', >\
t}} \
~#*>1 >1r   