ef;ddlmZddlmZddlmZddlmcmZddl Z ddl Z ddl Z ddl Z ddlZddlZddlmZddlmZmZmZmZmZmZddlmZdd lmZd Zd ZGd d ejZdZGddZ dS))partial)glob) convert_pathN)Path)DictIterableIteratorListOptionalTuple)unique_everseen)SetuptoolsDeprecationWarning)z*.pyizpy.typedcxtj|tj|jtjzdSN)oschmodstatst_modeS_IWRITE)targets {/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/setuptools/command/build_py.py make_writablers,HVRWV__,t}<=====czeZdZUdZdZeed<dZee ed<dZ d fd Z d Z d Z d Zd Zd ZdZdZd!dee ffd Zdee e ffdZdeee e ffdZdeee e ffdZdZdZdee de dee fdZdZdZ dZ!dZ"dZ#e$gfdZ%xZ&S)"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. F editable_modeNexisting_egg_info_dirctj||jj|_|jjpi|_d|jvr|jd=g|_dS)N data_files)origrfinalize_options distribution package_dataexclude_package_data__dict___build_py__updated_filesselfs rr"zbuild_py.finalize_options&s^ &&t,,, -:$($5$J$Pb! 4= ( ( l+!rc |r\tt|}tt|}t||||||Sr)strrresolvesuper copy_file)r)infileoutfile preserve_modepreserve_timeslinklevel __class__s rr/zbuild_py.copy_file.st  3f--//00F$w--//1122Gww  G]ND%   rc0|js|jr|jrdS|jr||jr(|||tj |ddS)z?Build modules, packages, and copy data files to build directoryNr)include_bytecode) py_modulespackagesr build_modulesbuild_packagesbuild_package_data byte_compiler!r get_outputsr(s rrunz build_py.run9s 4= T5G  F ? !    = &    ! ! !  # # % % % $-33D13MMNNNNNrc|dkr ||_|jStj||S)zlazily compute data filesr )_get_data_filesr r!r __getattr__)r)attrs rrCzbuild_py.__getattr__Is@ <  "2244DO? "}((t444rctj||||\}}|r|j|||fSr)r!r build_moduler'append)r)module module_filepackager1copieds rrFzbuild_py.build_modulePsK-44T6;PWXX  1  ' ' 0 0 0rc||tt|j|jpdS)z?Generate list of '(package,src_dir,build_dir,filenames)' tuples)analyze_manifestlistmap_get_pkg_data_filesr:r(s rrBzbuild_py._get_data_filesVs6 C0$-2E2FFGGGrc|jditt|j|jpdS)z Generate list of ``(package,src_dir,build_dir,filenames)`` tuples, but without triggering any attempt to analyze or build the manifest. manifest_filesrM)r& setdefaultrOrPrQr:r(s rget_data_files_without_manifestz(build_py.get_data_files_without_manifest[s?   !12666C0$-2E2FFGGGrc||tjj|jg|dz}fd||D}|||fS)N.cPg|]"}tj|#SrM)rpathrelpath).0filesrc_dirs r z0build_py._get_pkg_data_files..ms9    GOOD' * *   r)get_package_dirrrYjoin build_libsplitfind_data_files)r)rJ build_dir filenamesr]s @rrQzbuild_py._get_pkg_data_fileses&&w//GLDN#3gmmC6H6H#HJ     ,,Wg>>   I55rc||j||t}tt t d|}t j|}ttj j |}t j|j |g|}||||S)z6Return filenames for package's data files in 'src_dir')extra_patternsT) recursive)_get_platform_patternsr$_IMPLICIT_DATA_FILESrPrr itertoolschain from_iterablefilterrrYisfilerSgetexclude_data_files)r)rJr]patternsglobs_expanded globs_matches glob_filesfiless rrczbuild_py.find_data_filesss..    / /   WTT:::HEE!55nEE BGNM::    # #GR 0 0   &&w???rreturnc|jr3t|St |S)1See :class:`setuptools.commands.build.SubCommand`)rrOget_output_mappingkeysr.r?)r)r8r6s rr?zbuild_py.get_outputssM   ://11668899 9ww""#3444rctj||}t t |dS)ryc|dS)NrrM)xs rz-build_py.get_output_mapping..s !A$r)key)rkrl _get_package_data_output_mapping_get_module_mappingdictsorted)r)mappings rrzzbuild_py.get_output_mappingsP/  1 1 3 3  $ $ & &  F7777888rc#K|D]=\}}}|d}||j||}||fV>dS)z5Iterate over all modules producing (dest, src) pairs.rWN)find_all_modulesrbget_module_outfilera)r)rJrHrIfilenames rrzbuild_py._get_module_mappingsp,0,A,A,C,C * * (GV[mmC((G..t~wOOH[) ) ) ) ) * *rc#K|jD]R\}}}}|D]H}tj||}tj||}||fVISdS)z6Iterate over package data producing (dest, src) pairs.N)r rrYr`)r)rJr]rdrerrsrcfiles rrz)build_py._get_package_data_output_mappings|6:o ( ( 2GWi% ( (i::',,w99w''''' ( ( (rc|D]_\}}|tj||||\}}t |`dS)z$Copy data files into build directoryN)rmkpathrrYdirnamer/r)r)rr_outf_copieds rr=zbuild_py.build_package_datass#DDFF " "OFG KK// 0 0 0!^^GV<.s-BBBQBRW%%a((BBBrc3 K|]}|vV dSrrM)r[r norm_paths r z/build_py._filter_build_files..s(-T-TQay.@-T-T-T-T-T-TrN) rra build_temp build_baserrYrisabsall)r)rvrr build_dirs norm_dirsr\rs @rrzbuild_py._filter_build_filess**7330@%BRS BB*BBB   D((..I7==&& #-T-T-T-T)-T-T-T*T*T    rcdSrrMr(s rget_data_fileszbuild_py.get_data_filess rc |j|S#t$rYnwxYwtj|||}||j|<|r |jjs|S|jjD]"}||ks||dzrn#|St|d5}| }dddn #1swxYwYd|vr#tj d|d|S)z8Check namespace packages' __init__ for declare_namespacerWrbNsdeclare_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_packager#namespace_packages startswithopenread distutilserrorsDistutilsError)r)rJ package_dirinit_pypkgrcontentss rrzbuild_py.check_packagesi (1 1    D ---dG[II)0g& d/B N$7  Cg~~# !>!>~N '4  AvvxxH               x / /"111.s/OO7ug66OOOOOOrc3$K|] }|v|V dSrrM)r[fnbads rrz.build_py.exclude_data_files..s'77"3277r)rOrir%rkrlrmsetr) r)rJr]rvrr match_groupsmatcheskeepersrs ` @rrqzbuild_py.exclude_data_filessU ..  %     POOOhOOO /// =='ll7777777OG,,---rctj||dg||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. c3rK|]1}tjt|V2dSr)rrYr`r)r[rr]s rrz2build_py._get_platform_patterns../sQ   GLL,w"7"7 8 8      r)rkrlrp)specrJr]rg raw_patternss ` rrizbuild_py._get_platform_patterns"sh!  HHR   HHWb ! !      (    r)r*r*Nr*)r*)'__name__ __module__ __qualname____doc__rbool__annotations__rr r,r"r/r@rCrFrBrUrQrcr r?rrzr r rrr=rNrrrrrr_rq staticmethodri __classcell__)r6s@rrrs[ M4+/8C=///"""TU       OOO 555 HHH HHH 6 6 6@@@$55c555555 9DcN9999*XeCHo%>****((5c?2K(((("""'<'<'Inform users that package or module is included as 'data file'ceZdZdZdZdS)!_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_DETAILSrMrr_WarningrNs " rrc,t|_dSr)r_already_warnedr(s r__init__z!_IncludePackageDataAbuse.__init__ys"uurc|do)|dtd S)Nz.py)endswithlen isidentifier)r)r\s rrz"_IncludePackageDataAbuse.is_module|s6}}U##J]E {](;(H(H(J(JJrct|j}ttjt j|j}|rd|g|SdS)NrW) rparentrOrk takewhiler,rpartsr`)r)rr\rrs rrz._IncludePackageDataAbuse.importable_subpackagesV4jjY()939EEFF  .88V,e,-- -trc||jvr7|j||j|dSdS)N)r)rremitadd)r)rs rrz_IncludePackageDataAbuse.warnsN T1 1 1 M  *  5 5 5  $ $Z 0 0 0 0 0 2 1rN) rrrrrrrrrrrMrrrrKsHH' ' ' ' ' /' ' ' V%%%KKK11111rr)! functoolsrrdistutils.utilrdistutils.command.build_pycommandrr!rrrrrrkrpathlibrtypingrrr r r r extern.more_itertoolsrwarningsrrjrrrrMrrrs'''''')))))))))  BBBBBBBBBBBBBBBB333333333333->>>Z Z Z Z Z t}Z Z Z z###*>1>1>1>1>1>1>1>1>1>1r