K i<ddlmZddlZddlZddlZddlZddlZddlmZm Z ddl m Z ddl m Z ddl mZddlmZdd lmZmZdd lmZdd lmZddlmcmZddlZdd lmZd Z ddZ!Gddej4ZdZ"GddZ#y)) annotationsN)IterableIterator)partial)glob)Path)unique_everseen)StrPathStrPathT) Distribution)SetuptoolsDeprecationWarning) convert_path)z*.pyizpy.typedctj|tj|jtjzyN)oschmodstatst_modeS_IWRITE)targets a/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/setuptools/command/build_py.py make_writablers'HHVRWWV_,,t}}<=ceZdZUdZded<dZded<dZded <d Z d d fd Zd!d Z d"d Z dZ dZ dZ dZd#d$fd Zd%dZd&dZd&dZd!dZd!dZ d'dZd!dZdZdZdZdZed(dZxZS))build_pyaXEnhanced '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 distributionFbool editable_modeNzStrPath | Noneexisting_egg_info_dirctjj||jj|_|jj xsi|_d|j vr|j d=yy)N data_files)origrfinalize_optionsr package_dataexclude_package_data__dict__selfs rr$zbuild_py.finalize_options,s^ &&t, --::$($5$5$J$J$Pb! 4== ( l+ )rc|rDtt|j}tt|j}t|||||||Sr)strrresolvesuper copy_file)r)infileoutfile preserve_modepreserve_timeslinklevel __class__s rr.zbuild_py.copy_file3sU f--/0F$w-//12Gw G]ND%  rc>|js |jr |jry|jr|j|jr |j |j |j tjj|dy)z?Build modules, packages, and copy data files to build directoryNF)include_bytecode) py_modulespackagesr build_modulesbuild_packagesbuild_package_data byte_compiler#r get_outputsr(s rrunz build_py.runDsp4==T5G5G  ??    ==    !  # # % $--33D53QRrc|dk(r!|j|_|jStjj ||S)zlazily compute data filesr")_get_data_filesr"r#r __getattr__)r)attrs rrBzbuild_py.__getattr__Ts; < "224DO?? "}}((t44rc||jtt|j|jxsdS)z?Generate list of '(package,src_dir,build_dir,filenames)' tuples)analyze_manifestlistmap_get_pkg_data_filesr9r(s rrAzbuild_py._get_data_files[s/ C00$--2E2FGGrc|jjditt|j|j xsdS)z Generate list of ``(package,src_dir,build_dir,filenames)`` tuples, but without triggering any attempt to analyze or build the manifest. manifest_filesrE)r' setdefaultrGrHrIr9r(s rget_data_files_without_manifestz(build_py.get_data_files_without_manifest`s:   !126C00$--2E2FGGrc&|j|}tjj|jg|j dz}|j ||Dcgc]"}tjj||$}}||||fScc}wN.)get_package_dirrpathjoin build_libsplitfind_data_filesrelpath)r)packagesrc_dir build_dirfile filenamess rrIzbuild_py._get_pkg_data_filesjs&&w/GGLLDNN#3gmmC6H#HJ ,,Wg>  GGOOD' *  I55  s'Bc|j|j||t}tt t d|}t jj|}ttjj|}t j|jj|g|}|j|||S)z6Return filenames for package's data files in 'src_dir')extra_patternsT) recursive)_get_platform_patternsr%_IMPLICIT_DATA_FILESrHrr itertoolschain from_iterablefilterrrRisfilerKgetexclude_data_files)r)rXrYpatternsglobs_expanded globs_matches glob_filesfiless rrVzbuild_py.find_data_filesxs..     / /  WTT:HE!55nE BGGNNM:     # #GR 0  &&w??rc|jr't|jjSt||S)1See :class:`setuptools.commands.build.SubCommand`)rrGget_output_mappingkeysr-r>)r)r7r5s rr>zbuild_py.get_outputss:   //16689 9w"#344rctj|j|j}t t |dS)roc |dS)NrrE)xs rz-build_py.get_output_mapping..s !A$r)key)rbrc _get_package_data_output_mapping_get_module_mappingdictsorted)r)mappings rrpzbuild_py.get_output_mappings<//  1 1 3  $ $ & F7788rc#K|jD]:\}}}|jd}|j|j||}||f<yw)z5Iterate over all modules producing (dest, src) pairs.rPN)find_all_modulesrUget_module_outfilerT)r)rXmodule module_filefilenames rrxzbuild_py._get_module_mappingsV,0,A,A,C * (GV[mmC(G..t~~wOH[) ) *sAAc#K|jD]T\}}}}|D]H}tjj||}tjj||}||fJVyw)z6Iterate over package data producing (dest, src) pairs.N)r"rrRrS)r)rXrYrZr\rrsrcfiles rrwz)build_py._get_package_data_output_mappingsd6:oo ( 2GWi% (i:'',,w9w'' ( (sA%A'c|jD]S\}}|jtjj ||j ||\}}t |Uy)z$Copy data files into build directoryN)rwmkpathrrRdirnamer.r)r)rr_outf_copieds rr<zbuild_py.build_package_datasS#DDF "OFG KK/ 0!^^GVi|_|jjsyi}|jxsdD]}||t |j |<!|j r]t|j djr9|j }t|d}|jdj}nD|jd|jd}|j}|jj}t!}|j#||D]}t$j&j)t |\} } d} | } | rY| | k7rT| |vrP| } t$j&j)| \} } t$j&j+| | } | r | | k7r| |vrP| |vs| | k(r|j-| r)|j/|| | }|r|j1||jj3|| gj5|y)NrEz SOURCES.txtzutf-8)encodingegg_info)rKrinclude_package_datar9assert_relativerQr rexists read_text splitlines run_commandget_finalized_commandrfilelistrm_IncludePackageDataAbuse_filter_build_filesrrRrUrS is_moduleimportable_subpackagewarnrLappend)r)src_dirsrX egg_info_dirmanifestrmei_cmdcheckrRdfprevoldfdf importables rrFzbuild_py.analyze_manifests46  55 #%}}* OGGNH_T%9%9'%BC D O  & &T//?FFH55LL-8H&&&8CCEE   Z (// ;F!??LOO))E(*,,ULA MD77==!67DAqDDT ax&7 a(2GGLLQ'T ax&7H}9q) !&!z/build_py._filter_build_files..s-TQay.@-TsN) rrT build_temp build_baserrRnormpathisabsall) r)rmrr build_dirsp norm_dirsr[rs @rrzbuild_py._filter_build_filess**730@0@%BRBRS 2<BQRWW%%a(B B D((.I77==&#-T)-T*T  Cs:C C!C&AC  C cyrrEr(s rget_data_fileszbuild_py.get_data_filess rc |j|S#t$rYnwxYwtjj |||}||j|<|r|j j s|S|j j D]}||k(s|j|dzsn|St|d5}|j}dddn #1swYnxYwdvr#tjjd|d|S)z8Check namespace packages' __init__ for declare_namespacerPrbNsdeclare_namespacezNamespace 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_checkedKeyErrorr#r check_packagernamespace_packages startswithopenread distutilserrorsDistutilsError)r)rX package_dirinit_pypkgrcontentss rrzbuild_py.check_packages  ((1 1   ----dG[I)0g&d//BBN$$77 Cg~# !> N '4  AvvxH   x /""11-gY788  s .CCcli|_tjj|d|_d|_y)NF)rr#rinitialize_optionsrr r(s rrzbuild_py.initialize_options s, " ((."%)"rctjj||}|jj4t j j|jj|S|Sr)r#rrQrsrc_rootrrRrS)r)rXress rrQzbuild_py.get_package_dirsPmm++D':    % % 177<< 1 1 : :C@ @ rct|j|j||}fd|D}tjj |}t |fdD}tt|S)z6Filter filenames for package's data files in 'src_dir'c3JK|]}tj|ywr)fnmatchre)rpatternrms rrz.build_py.exclude_data_files..!sO7ug6Os #c3,K|] }|vs| ywrrE)rfnbads rrz.build_py.exclude_data_files..%s7"327s )rGr`r&rbrcrdsetr ) r)rXrYrmri match_groupsmatcheskeepersrs ` @rrhzbuild_py.exclude_data_filessoU ..  % %    PhO //// ='l77OG,--rctj||jdg|j|g}fd|DS)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. c3pK|]-}tjjt|/ywr)rrRrSr)rrrYs rrz2build_py._get_platform_patterns..6s/  GGLL,w"7 8 s36)rbrcrg)specrXrYr^ raw_patternss ` rr`zbuild_py._get_platform_patterns)sF!  HHR  HHWb !  (  r)TTN)r/r r0r r1rr2rr3z str | Noner4objectreturnztuple[StrPathT | str, bool]rNone)rCr+)T)r7rrz list[str])rzdict[str, str])rzIterator[tuple[str, str]])rmz Iterable[str]rr rz Iterator[str])rE)__name__ __module__ __qualname____doc____annotations__rr r$r.r?rBrArMrIrVr>rprxrwr<rFrrrrrQrh staticmethodr` __classcell__)r5s@rrrs M4,0>0,##           % "S 5H H 6@$5 9*("'MR".5 * <*  .   rrctjj|s|Sddlm}t j dj|z}||)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. )rrRrdistutils.errorsrtextwrapdedentlstrip)rRrmsgs rrr=sP 77==  4    &(   c ""rc>eZdZdZGddeZdZdZdZdZ y) rz>Inform users that package or module is included as 'data file'ceZdZdZdZy)!_IncludePackageDataAbuse._WarningzU 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. N)rrr_SUMMARY_DETAILSrErr_WarningrUs " rrc"t|_yr)r_already_warnedr(s r__init__z!_IncludePackageDataAbuse.__init__s "urcb|jdxr|dtd jS)Nz.py)endswithlen isidentifier)r)r[s rrz"_IncludePackageDataAbuse.is_modules,}}U#J]E {(;(H(H(JJrct|j}ttjt j |j}|rdj|g|SyrO) rparentrGrb takewhiler+rpartsrS)r)rr[rrs rrz._IncludePackageDataAbuse.importable_subpackagesO4jY(()9)9399EF 88V,e,- -rc||jvr8|jj||jj|yy)N)r)rremitadd)r)rs rrz_IncludePackageDataAbuse.warns> T11 1 MM  *  5  $ $Z 0 2rN) rrrrrrrrrrrErrrrRs(H' /' V%K1rrr)$ __future__rrrbrrrcollections.abcrr functoolsrrpathlibrmore_itertoolsr _pathr r distr warningsrdistutils.command.build_pycommandrr#rrdistutils.utilrrarrrrErrr sh" .*%3))',>\ t}}\ ~#*>1>1r