Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
build_py.cpython-313.pyc162 linesDownload Raw Back to __pycache__
1�

2`j�=��,�SSKJr SSKrSSKrSSKrSSKrSSKrSSKrSSKJ	r	J3r4 SSKJr SSK
J
r
 SSKJr SSKJr SSKJr S	S5KJrJr S	SKJr S	SKJr SSKJs Jr SSKr SS
K!J"r" Sr#SSjr$"SS\R:5rSr%"SS5r&g)�)�annotationsN)�Iterable�Iterator)�partial)�glob)�Path)�Any)�unique_everseen�)�StrPath�StrPathT)�Distribution)�SetuptoolsDeprecationWarning)�convert_path)z*.pyizpy.typedc��[R"U[R"U5R[R-5 g�N)�os�chmod�stat�st_mode�S_IWRITE)�targets �MD:\code\apps\devtools\python\Lib\site-packages\setuptools/command/build_py.py�
make_writablers'���H�H�V�R�W�W�V�_�,�,�t�}�}�<�=�c�R^�\rSrSr%SrS\S'SrS\S'SrS	\S6'S!SjrS"S#U4Sjjjr	S!S
jr7S$SjrSrS%Sjr
S&SjrSrS'S(U4SjjjrS)SjrS*SjrS*SjrS!SjrS!SjrS+SjrS!SjrSrSrS,SjrSr\S-Sj5rS rU=r$).�build_py� aDEnhanced 'build_py' command that includes data files with packages8 9The data files are specified via a 'package_data' argument to 'setup()'.10See 'setuptools.dist.Distribution' for more details.11 12Also, this version of the 'build_py' command allows you to specify both13'py_modules' and 'packages' in the same setup operation.14r�distributionF�bool�
editable_modeNzStrPath | None�existing_egg_info_dirc���[RRU5 URRUlURR15=(d 0UlSUR;aURS	gg)N�16data_files)�origr�finalize_optionsr�package_data�exclude_package_data�__dict__��selfs rr&�build_py.finalize_options.s^���
�
�&�&�t�,� �-�-�:�:���$(�$5�$5�$J�$J�$P�b��!��4�=�=�(��
�
�l�+�)rc�>�U(aD[[U5R55n[[U5R55n[TU]XX4XV5$r)�strr�resolve�super�	copy_file)r+�infile�outfile�
preserve_mode�preserve_times�link�level�	__class__s       �rr1�build_py.copy_file5sO������f��-�-�/�0�F��$�w�-�/�/�1�2�G��w� ��]�D�17�	18rc�j�UR(dUR(aUR(agUR(aUR5 UR(a UR	5 UR5 UR
[RRUSS95 g)z?Build modules, packages, and copy data files to build directoryNF)�include_bytecode)19�20py_modules�packagesr!�
build_modules�build_packages�build_package_data�byte_compiler%r�get_outputsr*s r�run�build_py.runFsp�����4�=�=�T�5G�5G���?�?���� ��=�=����!��#�#�%�	
���$�-�-�3�3�D�5�3�Q�Rrc��US:Xa!UR5UlUR$[RR	X5$)zlazily compute data filesr$)�_get_data_filesr$r%r�__getattr__)r+�attrs  rrG�build_py.__getattr__Ws9���<��"�2�2�4�D�O��?�?�"��}�}�(�(��4�4rc��UR5 [[URUR=(d S55$)z?Generate list of '(package,src_dir,build_dir,filenames)' tuples�)�analyze_manifest�list�map�_get_pkg_data_filesr=r*s rrF�build_py._get_data_files^s/�������C��0�0�$�-�-�2E�2�F�G�Grc��URRS05 [[URUR21=(d S55$)z�22Generate list of ``(package,src_dir,build_dir,filenames)`` tuples,23but without triggering any attempt to analyze or build the manifest.24�manifest_filesrK)r)�25setdefaultrMrNrOr=r*s r�get_data_files_without_manifest�(build_py.get_data_files_without_manifestcs:��	
�
�
� � �!1�2�6��C��0�0�$�-�-�2E�2�F�G�Grc�&�URU5n[RR"UR/URS5-6nUR
X5Vs/sH"n[RRXB5PM$ nnXX54$s snf�N�.)�get_package_dirr�path�join�	build_lib�split�find_data_files�relpath)r+�package�src_dir�	build_dir�file�	filenamess      rrO�build_py._get_pkg_data_filesms����&�&�w�/���G�G�L�L�D�N�N�#3�g�m�m�C�6H�#H�J�	�26�,�,�W�>�27�>��
�G�G�O�O�D�*�>�	�28���5�5��	29s�)Bc�~�URURUU[S9n[[	[30SS9U5n[RRU5n[[RRU5n[R"URRU/5U5nURXU5$)z6Return filenames for package's data files in 'src_dir')�extra_patternsT)�	recursive)�_get_platform_patternsr'�_IMPLICIT_DATA_FILESrNrr�	itertools�chain�
from_iterable�filterrrZ�isfilerR�get�exclude_data_files)r+r`ra�patterns�globs_expanded�
globs_matches�31glob_files�filess        rr^�build_py.find_data_files{s����.�.������/�	/�32���W�T�T�:�H�E��!���5�5�n�E�
��B�G�G�N�N�M�:�33�������#�#�G�R�0��34���&�&�w��?�?rc�>�UR(a'[UR5R55$[TU]U5$)�1See :class:`setuptools.commands.build.SubCommand`)r!rM�get_output_mapping�keysr0rB)r+r;r8s  �rrB�build_py.get_outputs�s:��������/�/�1�6�6�8�9�9��w�"�#3�4�4rc��[R"UR5UR55n[	[U[R"S5S95$)ryr)�key)rkrl� _get_package_data_output_mapping�_get_module_mapping�dict�sorted�operator�35itemgetter)r+�mappings  rrz�build_py.get_output_mapping�sG���/�/��1�1�3��$�$�&�36���F�7��(;�(;�A�(>�?�@�@rc#�# �UR5H8upnURS5nURURX5nXC4v� M: g7f)z5Iterate over all modules producing (dest, src) pairs.rXN)�find_all_modulesr]�get_module_outfiler\)r+r`�module�module_file�filenames     rr��build_py._get_module_mapping�sK���,0�,A�,A�,C�(�G�[��m�m�C�(�G��.�.�t�~�~�w�O�H��)�)�-D�s�AAc#��# �URHRupp4UHFn[RRX55n[RRX%5nXg4v� MH MT g7f)z6Iterate over package data producing (dest, src) pairs.N)r$rrZr[)r+r`rarbrdr�r�srcfiles        rr�)build_py._get_package_data_output_mapping�sP���6:�o�o�2�G�i�%�������i�:���'�'�,�,�w�9���'�'�&�7F�s�A$A&c���UR5HQupUR[RR	U55 URX!5up4[
U5 MS g)z$Copy data files into build directoryN)r�mkpathrrZ�dirnamer1r)r+rr��_outf�_copieds     rr@�build_py.build_package_data�sI��#�D�D�F�O�F��K�K�������/�0�!�^�^�G�<�N�E��&�!� Grc��0UlURR(dg0nUR=(d SHnX![	URU55'M! UR(a_[URS5R5(a6URn[US5nURSS9R5nODURS5 URS5nURnURRn[!5nUR#XS5GHn[$R&R)[	U55up�SnU37nU	(a_X�:waZX�;aUU	n[$R&R)U	5up�[$R&R+X�5n38U	(aX�:waX�;aMUX�;dM�X�:XaUR-U395(aM�O,UR/XU405nU(aUR1U5 URR3X/5R5U5 GM g)NrKzSOURCES.txtzutf-8)�encoding�egg_info)rRr�include_package_datar=�assert_relativerYr"r�exists�	read_text�41splitlines�run_command�get_finalized_commandr��filelistrv�_IncludePackageDataAbuse�_filter_build_filesrrZr]r[�	is_module�importable_subpackage�warnrS�append)r+�src_dirsr`�egg_info_dir�manifestrv�ei_cmd�checkrZ�d�f�prev�oldf�df�42importables               rrL�build_py.analyze_manifest�s���46���� � �5�5��#%���}�}�*��*�G�GN�_�T�%9�%9�'�%B�C�D�+�43
�&�&��T�/�/��?�F�F�H�H��5�5�L��L�-�8�H��&�&��&�8�C�C�E�E����Z�(��/�/�44�;�F�!�?�?�L��O�O�)�)�E�(�*���,�,�U�A�D��7�7�=�=���!6�7�D�A��D��D���	�a�&7������
�
�a�(����G�G�L�L��'����	�a�&7��}��9����q�)�)� �*�"'�!<�!<�X�[�!�!L�J�!��45�46�:�.��#�#�.�.�x�{�B�?�F�F�t�L�!Brc#��^# �URS5nX RURUR4nUVs/sH*oU(dM[R47R
U5PM, nnUHfn[R48R
U5m[R49RU5(a[U4SjU55(dMbUv� Mh gs snf7f)aM50``build_meta`` may try to create egg_info outside of the project directory,51and this can be problematic for certain plugins (reported in issue #3500).52 53Extensions might also include between their sources files created on the54``build_lib`` and ``build_temp`` directories.55 56This function should filter this case of invalid files out.57�buildc3�,># �UH	oT;v� M g7frrK)�.0r��	norm_paths  �r�	<genexpr>�/build_py._filter_build_files.<locals>.<genexpr>�s����-T�)�Q�y�.@�)�s�N)	r�r\�58build_temp�59build_baserrZ�normpath�isabs�all)	r+rvr�r��60build_dirs�p�	norm_dirsrcr�s	        @rr��build_py._filter_build_files�s������*�*�7�3������0@�0@�%�BR�BR�S�61�2<�B�*�Q��(�R�W�W�%�%�a�(�*�	�B��D����(�(��.�I��7�7�=�=��&�&�#�-T�)�-T�*T�*T��62���C�s�9C!�63C�64#C�-A"C!�C!c��grrKr*s r�get_data_files�build_py.get_data_files�s��rc�(�URU$![a Of=f[RR	XU5nX0RU'U(aUR65R(dU$UR66RH#nXA:XdURUS-5(dM# O U$[US5nUR5nSSS5 O!,(df   O=fSW;a#[RRSUS35eU$)z8Check namespace packages' __init__ for declare_namespacerX�rbNsdeclare_namespacezNamespace package problem: z� is a namespace package, but its67__init__.py does not call declare_namespace()! Please fix it.68(See the setuptools manual under "Namespace Packages" for details.)69")
�packages_checked�KeyErrorr%r�
check_packager�namespace_packages�70startswith�open�read�	distutils�errors�DistutilsError)r+r`�package_dir�init_py�pkgr��contentss       rr��build_py.check_package�s���	��(�(��1�1���	��	���-�-�-�-�d�[�I��)0���g�&��d�/�/�B�B��N��$�$�7�7�C��~�����#�
�!>�!>��8��N�
�'�4�
 �A��v�v�x�H�!�
 �
 ���x�/��"�"�1�1�-�g�Y�78�8��
��s��71��>C�72C&c�l�0Ul[RRU5 SUlSUlg)NF)r�r%r�initialize_optionsr!r"r*s rr��build_py.initialize_optionss,�� "����
�
�(�(��.�"���%)��"rc���[RRX5nURRb4[73RRURRU5$U$r)r%rrYr�src_rootrrZr[)r+r`�ress   rrY�build_py.get_package_dirsN���m�m�+�+�D�:�����%�%�1��7�7�<�<�� 1� 1� :� :�C�@�@��74rc�^^�[T5mURURUU5nU4SjU5n[RRU5n[
U5mU4SjT5n[[U55$)z6Filter filenames for package's data files in 'src_dir'c3�R># �UHn[R"TU5v� M g7fr)�fnmatchrn)r��patternrvs  �rr��.build_py.exclude_data_files.<locals>.<genexpr>$s����O�h�7����u�g�6�6�h�s�$'c3�6># �UHoT;dM75Uv� M g7frrK)r��fn�bads  �rr�r�(s����7��"�3��2�2��s�	�	)rMrir(rkrlrm�setr76)	r+r`rarvrr�match_groups�matches�keepersr�s	   `    @rrq�build_py.exclude_data_filesso����U����.�.��%�%���77��78P�h�O���/�/�/�/��=���'�l��7��7���O�G�,�-�-rc�^�[R"UURS/5URU/55nU4SjU5$)z�79yield platform-specific path patterns (suitable for glob80or fn_match) from a glob-based spec (such as81self.package_data or self.exclude_package_data)82matching package in src_dir.83�c3�v># �UH.n[RRT[U55v� M0 g7fr)rrZr[r)r�r�ras  �rr��2build_py._get_platform_patterns.<locals>.<genexpr>9s1����84�(��
�G�G�L�L��,�w�"7�8�8�'�s�69)rkrlrp)�specr`rarg�raw_patternss  `  rri�build_py._get_platform_patterns,sF���!�����H�H�R����H�H�W�b�!�85��8687�(�88�	89r)r$r!r(r"rRr'r���return�None)TTN�)r2rr3r
r4r r5r r6z90str | Noner7�objectr�ztuple[StrPathT | str, bool])rHr.r�r	)r�z%list[tuple[str, str, str, list[str]]])r`r.r�ztuple[str, str, str, list[str]])T)r;r r�z	list[str])r�zdict[str, str])r�zIterator[tuple[str, str]])rvz
Iterable[str]r�rr�z
Iterator[str])r`r.r�r.)rK) �__name__�91__module__�__qualname__�__firstlineno__�__doc__�__annotations__r!r"r&r1rCrGrFrTrOr^rBrzr�rr@rLr�r�r�r�rYrq�staticmethodri�__static_attributes__�
__classcell__)r8s@rrr s�������M�4��,0��>�0�,�#�#���92��93��94��	95�96�97��
98��99�100%�101�102�"S�"5�H�103H�6�@�$5�5�A�*�(�"�'M�R�"��.5��	��*
��<*��.� �104��105rrc��[RRU5(dU$SSKJn [106R"S5R5U-nU"U5e)Nr)�DistutilsSetupErrorz�107        Error: setup script specifies an absolute path:108 109            %s110 111        setup() arguments must *always* be /-separated paths relative to the112        setup.py directory, *never* absolute paths.113        )rrZr��distutils.errorsr�textwrap�dedent�lstrip)rZr�msgs   rr�r�@sS��
�7�7�=�=������4�	���
�		114��&�(�115�116	���c�117"�"rc�J�\rSrSrSr"SS\5rSSjrSrSr	Sr118S	rg119)r�iUz>Inform users that package or module is included as 'data file'c��\rSrSrSrSrSrg)�!_IncludePackageDataAbuse._WarningiXzU120        Package {importable!r} is absent from the `packages` configuration.121        a|122        ############################123        # Package would be ignored #124        ############################125        Python recognizes {importable!r} as an importable package[^1],126        but it is absent from setuptools' `packages` configuration.127 128        This leads to an ambiguous overall configuration. If you want to distribute this129        package, please make sure that {importable!r} is explicitly added130        to the `packages` configuration field.131 132        Alternatively, you can also rely on setuptools' discovery methods133        (for example by using `find_namespace_packages(...)`/`find_namespace:`134        instead of `find_packages(...)`/`find:`).135 136        You can read more about "package discovery" on setuptools documentation page:137 138        - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html139 140        If you don't want {importable!r} to be distributed and are141        already explicitly excluding {importable!r} via142        `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,143        you can try to use `exclude_package_data`, or `include-package-data=False` in144        combination with a more fine grained `package-data` configuration.145 146        You can read more about "package data files" on setuptools documentation page:147 148        - https://setuptools.pypa.io/en/latest/userguide/datafiles.html149 150 151        [^1]: For Python, any directory (with suitable naming) can be imported,152              even if it does not contain any `.py` files.153              On the other hand, currently there is no concept of package data154              directory, all directories are treated like packages.155        rKN)r�r�r�r��_SUMMARY�_DETAILSr�rKrr�_Warningr156Xs����"�rr
c�2�[["5Ulgr)r�r.�_already_warnedr*s r�__init__�!_IncludePackageDataAbuse.__init__�s��"�3�x�z��rc�l�URS5=(a US[S5*R5$)Nz.py)�endswith�len�isidentifier)r+rcs  rr��"_IncludePackageDataAbuse.is_module�s,���}�}�U�#�J��]��E�157�{�(;�(H�(H�(J�Jrc���[U5Rn[[R"[158RUR55nU(aSRU/UQ5$grW)	r�parentrMrk�	takewhiler.r�partsr[)r+rrcr�rs     rr��._IncludePackageDataAbuse.importable_subpackage�sO���4�j�����Y�(�(��)9�)9�3�9�9�E�F����8�8�V�,�e�,�-�-�rc��XR;a5URRUS9 URRU5 gg)N)r�)rr
�emit�add)r+r�s  rr��_IncludePackageDataAbuse.warn�s<���1�1�1��M�M���*��5�� � �$�$�Z�0�2r)rNr�)r�r�r�r�r�rr
rr�r�r�r�rKrrr�r�Us(��H�'�/�'�V*�K��1rr�r�)'�159__future__rr�rkr�rrr�collections.abcrr�	functoolsrr�pathlibr�typingr	�more_itertoolsr160�_pathrr
�distr�warningsr�distutils.command.build_py�commandrr%rr��distutils.utilrrjrr�r�rKrr�<module>r,sn��"����	���.�����*�%��3�)�)��'�,��>�]161�t�}�}�]162�@	#�*>1�>1r
codekingpro/portable-devtools · Team Ai