_i;ddlmZddlmZddlmZddlmcmZddl Z ddl Z ddl Z ddl Z ddlZddlZddlmZddlmZmZmZmZmZmZddlmZdd lmZd Zd ZGd d ejZdZGddZ y))partial)glob) convert_pathN)Path)DictIterableIteratorListOptionalTuple)unique_everseen)SetuptoolsDeprecationWarning)z*.pyizpy.typedctj|tj|jtjzyN)oschmodstatst_modeS_IWRITE)targets /builddir/build/BUILDROOT/alt-python312-setuptools-69.0.2-3.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/setuptools/command/build_py.py make_writablers'HHVRWWV_,,t}}<=c>eZdZUdZdZeed<dZee ed<dZ dfd Z dZ d Z d Zd Zd Zd ZdZd 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_dirctjj||jj|_|jj xsi|_d|j vr |j d=g|_y)N data_files)origrfinalize_options distribution package_dataexclude_package_data__dict___build_py__updated_filesselfs rr"zbuild_py.finalize_options&sa &&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_file.sU 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 directoryNr)include_bytecode) py_modulespackagesr build_modulesbuild_packagesbuild_package_data byte_compiler!r get_outputsr(s rrunz build_py.run9sp4==T5G5G  ??    ==    !  # # % $--33D13MNrc|dk(r!|j|_|jStjj ||S)zlazily compute data filesr )_get_data_filesr r!r __getattr__)r)attrs rrBzbuild_py.__getattr__Is; < "224DO?? "}}((t44rctjj||||\}}|r|jj |||fSr)r!r build_moduler'append)r)module module_filepackager0copieds rrEzbuild_py.build_modulePsB--44T6;PWX   ' ' 0rc||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_filesVs/ 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_filesrL)r& setdefaultrNrOrPr9r(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)rIsrc_dir build_dirfile filenamess rrPzbuild_py._get_pkg_data_fileses&&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_FILESrOrr itertoolschain from_iterablefilterrrYisfilerRgetexclude_data_files)r)rIr_patternsglobs_expanded globs_matches glob_filesfiless rr]zbuild_py.find_data_filesss..     / /  WTT:HE!55nE BGGNNM:     # #GR 0  &&w??rreturnc|jr't|jjSt||S)1See :class:`setuptools.commands.build.SubCommand`)rrNget_output_mappingkeysr-r>)r)r7r5s rr>zbuild_py.get_outputss:   //16689 9w"#344rctj|j|j}t t |dS)rvc |dS)NrrL)xs rz-build_py.get_output_mapping..s!A$r)key)rhri _get_package_data_output_mapping_get_module_mappingdictsorted)r)mappings rrwzbuild_py.get_output_mappings<//  1 1 3  $ $ & F7788rc#K|jD]:\}}}|jd}|j|j||}||f<yw)z5Iterate over all modules producing (dest, src) pairs.rWN)find_all_modulesr\get_module_outfiler[)r)rIrGrHfilenames rrzbuild_py._get_module_mappingsR,0,A,A,C (GV[mmC(G..t~~wOH[) )-DsAAc#K|jD]T\}}}}|D]H}tjj||}tjj||}||fJVyw)z6Iterate over package data producing (dest, src) pairs.N)r rrYrZ)r)rIr_r`rbrrsrcfiles rr~z)build_py._get_package_data_output_mappings[6:oo 2GWi%i:'',,w9w''&7FsA%A'c|jD]S\}}|jtjj ||j ||\}}t |Uy)z$Copy data files into build directoryN)r~mkpathrrYdirnamer.r)r)rr_outf_copieds rr<zbuild_py.build_package_datasO#DDFOFG KK/ 0!^^GVz/build_py._filter_build_files..s-T)Qay.@)sN) rr[ build_temp build_baserrYnormpathisabsall) r)rsrr build_dirsp norm_dirsrars @rrzbuild_py._filter_build_filess**730@0@%BRBRS 2<B*QRWW%%a(* BD((.I77==&#-T)-T*T Cs:C C!C&AC  C cyrrLr(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_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)rI package_dirinit_pypkgrcontentss rrzbuild_py.check_packages ((1 1   ----dG[I)0g&d//BBN$$77Cg~# !>8N '4 AvvxH! x /""11.sOh7ug6hs #c3,K|] }|vs| ywrrL)rfnbads rrz.build_py.exclude_data_files..s7"32s )rNrfr%rhrirjsetr) r)rIr_rsro match_groupsmatcheskeepersrs ` @rrnzbuild_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)rrYrZr)rrr_s rrz2build_py._get_platform_patterns../s/ ( GGLL,w"7 8's36)rhrirm)specrIr_rd raw_patternss ` rrfzbuild_py._get_platform_patterns"sF!  HHR  HHWb !  (  r)rNr)r)'__name__ __module__ __qualname____doc__rbool__annotations__rr r+r"r.r?rBrErArTrPr]r r>rrwr r rr~r<rMrrrrrrXrn staticmethodrf __classcell__)r5s@rrrs M4+/8C=/"TU  O 5 H H 6@$5c5 9DcN9*XeCHo%>*((5c?2K("'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_DETAILSrLrr_WarningrNs " rrc"t|_yr)r_already_warnedr(s r__init__z!_IncludePackageDataAbuse.__init__ys "urcb|jdxr|dtd jS)Nz.py)endswithlen isidentifier)r)ras rrz"_IncludePackageDataAbuse.is_module|s,}}U#J]E {(;(H(H(JJrct|j}ttjt j |j}|rdj|g|SyrV) rparentrNrh takewhiler+rpartsrZ)r)rrarrs 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) rrrrrrrrrrrLrrrrKs(H' /' V%K1rr)! functoolsrrdistutils.utilrdistutils.command.build_pycommandrr!rrrrrrhrpathlibrtypingrrr r r r extern.more_itertoolsrwarningsrrgrrrrLrrr sd'))  BB33->Z t}}Z z#*>1>1r