Team Ai
Datasetpublic

codekingpro/portable-devtools

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

2��j~D��Z�SrSSKJr SSKrSSKrSSKrSSKrSSKrSSK	r	SSK3r4SSKrSSKrSSK
r
SSKJrJrJr SSKJrJr SSKJr SSKJr SS	KJr SS5KJrJr SSKJr \(aSSKJ r J!r! \ "S
5r"S$Sjr#S$Sjr$\RJS:XaSq&Sr'Sr(Sr)Sr*S%Sjr+\S&Sj5r,S'Sjr-\R\S(Sj5r/S)Sjr0Sr1S*S+Sjjr2S=q3=q4q5Sr6S,Sjr7S-S.Sjjr8S/Sjr9S0S1S jjr:S2S!jr;S3S"jr<S#r=g)4zudistutils.util6 7Miscellaneous utility functions -- anything that doesn't fit into8one of the other *util.py modules.9�)�annotationsN)�Callable�Iterable�Mapping)�
TYPE_CHECKING�AnyStr)�	pass_none�)�log)�newer)�DistutilsByteCompileError�DistutilsPlatformError)�spawn)�TypeVarTuple�Unpack�_Tsc�,�[R"5$)z�10Return a string that identifies the current platform. Use this11function to distinguish platform-specific build directories and12platform-specific built distributions.13)�	sysconfig�get_platform���`D:\code\apps\devtools\python\user_packages\Python313\site-packages\setuptools/_distutils/util.py�get_host_platformr#s���!�!�#�#rc���[RS:XaHSSSSS.n[RRS5nURU5=(d14 [	5$[	5$)N�nt�win32z	win-amd64z	win-arm32z	win-arm64)�x86�x64�arm�arm64�VSCMD_ARG_TGT_ARCH)�os�name�environ�getr)�TARGET_TO_PLAT�targets  rrr1sX��	�w�w�$����� �	15������� 4�5���!�!�&�)�@�->�-@�@���r�darwin�MACOSX_DEPLOYMENT_TARGETc��Sqg)zFor testing only. Do not call.N)�_syscfg_macosx_verrrr�_clear_cached_macosx_verr,Cs16���rc�x�[c.SSKJn UR"[5=(d SnU(aUq[$)z�Get the version of macOS latched in the Python interpreter configuration.17Returns the version as a string or None if can't obtain one. Cached.r)r�)r+�	distutilsr�get_config_var�MACOSX_VERSION_VAR)r�vers  r�!get_macosx_target_ver_from_syscfgr3Is2���!�'��&�&�'9�:�@�b���!$���rc��[5n[RR[5nU(aIU(a@[U5SS/:�a/[U5SS/:aS[-SUSUS3-n[
U5eU$U$)aReturn the version of macOS for which we are building.18 19The target version defaults to the version in sysconfig latched at time20the Python interpreter was built, unless overridden by an environment21variable. If neither source has a value, then None is returned�22��$z mismatch: now "z" but "z*" during configure; must use 10.3 or later)r3r"r$r%r1�
split_versionr)�23syscfg_ver�env_ver�my_msgs   r�get_macosx_target_verr<Vs���3�4�J��j�j�n�n�/�0�G��
��j�)�b�!�W�4��g�&�"�a��0��(�(�,��y��24�|�4)�,)�)�
�25)��0�0����rc�b�URS5Vs/sHn[U5PM sn$s snf)zEConvert a dot-separated string into a list of numbers for comparisons�.)�split�int)�s�ns  rr8r8vs&���G�G�C�L�)�L�q�C��F�L�)�)��)s�,c�V�[R"[R"U55$)a2627Allow for pathlib.Path inputs, coax to a native path string.28 29If None is passed, will just pass it through as30Setuptools relies on this behavior.31 32>>> convert_path(None) is None33True34 35Removes empty paths.36 37>>> convert_path('foo/./bar').replace('\\', '/')38'foo/bar'39)r"�fspath�pathlib�PurePath)�pathnames r�convert_pathrH{s�� �9�9�W�%�%�h�/�0�0rc��[RS:Xae[RRU5(d[RR	X5$[RR	XSS5$[RS:Xa\[RRU5up#US[R:XaUSSn[RR	X5$[S[RS35e)z�Return 'pathname' with 'new_root' prepended.  If 'pathname' is40relative, this is equivalent to "os.path.join(new_root,pathname)".41Otherwise, it requires making 'pathname' relative and then joining the42two, which is tricky on DOS/Windows and Mac OS.43�posixr44Nrrznothing known about platform '�')r"r#�path�isabs�join�45splitdrive�sepr)�new_rootrG�driverLs    r�change_rootrS�s���46�w�w�'���w�w�}�}�X�&�&��7�7�<�<��3�3��7�7�<�<��1�2�,�7�7�	���D�����*�*�8�4�
����7�b�f�f�����8�D��w�w�|�|�H�+�+�47 �#A�"�'�'��!�!L�48M�Mrc�Z�[RS:XaQS[R;a=SSKnUR	[R49"55S[RS'S[R;a[5[RS'gg![[4a NCf=f)a4Ensure that 'os.environ' has all the environment variables we50guarantee that users can use in config files, command-line options,51etc.  Currently this includes:52  HOME - user's home directory (Unix only)53  PLAT - description of the current platform, including hardware54         and OS (see 'get_platform()')55rJ�HOMErN��PLAT)	r"r#r$�pwd�getpwuid�getuid�ImportError�KeyErrorr)rXs r�
check_environr]�s���56�w�w�'��f�B�J�J�6�	��!$���b�i�i�k�!:�1�!=�B�J�J�v���R�Z�Z��)�^��57�58�6�� ���X�&�	�
�	�s�<B�B*�)B*c�59�[5 [[R5nUR	SUR555 [
U5RU5$![an[SU35eSnAff=f)a�60Perform variable substitution on 'string'.61Variables are indicated by format-style braces ("{var}").62Variable is substituted by the value found in the 'local_vars'63dictionary or in 'os.environ' if it's not in 'local_vars'.64'os.environ' is first checked/augmented to guarantee that it contains65certain values: see 'check_environ()'.  Raise ValueError for any66variables not found in either 'local_vars' or 'os.environ'.67c3�@# �UHupU[U54v� M g7f�N��str)�.0r#�values   r�	<genexpr>�subst_vars.<locals>.<genexpr>�s���K�8J���4��U��$�8J�s�zinvalid variable N)68r]�dictr"r$�update�items�
_subst_compat�69format_mapr\�70ValueError)rA�71local_vars�lookup�vars    r�72subst_varsrp�sp���O�
�"�*�*�
�F�73�M�M�K�74�8H�8H�8J�K�K�4��Q��*�*�6�2�2���4��,�S�E�2�3�3��4�s�A%�%75B�/A=�=Bc�x�Sn[R"SX5nX :waSSKnURS[5 U$)zV76Replace shell/Perl-style variable substitution with77format-style. For compatibility.78c�,�SURS5S3$)N�{r79�})�group)�matchs r�_subst�_subst_compat.<locals>._subst�s���E�K�K��N�#�2�&�&rz\$([a-zA-Z_][a-zA-Z_0-9]*)rNz-shell/Perl-style substitutions are deprecated)�re�sub�warnings�warn�DeprecationWarning)rArw�replr{s    rrjrj�s;��'��6�6�/��;�D��y���
�
�;��	80��Krc��U[U5-$r`ra)�exc�prefixs  r�grok_environment_errorr��s���C��H��rc��[R"S[RS35q[R"S5q[R"S5qg)Nz[^\\\'\"z ]*z'(?:[^'\\]|\\.)*'z"(?:[^"\\]|\\.)*")ry�compile�string�81whitespace�
_wordchars_re�82_squote_re�83_dquote_rerrr�_init_regexr��s>���J�J�(�6�+<�+<�*=�S�A�B�M����0�1�J����0�1�Jrc�:�[c84[5 UR5n/nSnU(Gam[RX5nUR	5nU[U5:XaUR
USU5 U$X[R;a)UR
USU5 XSR5nSnO�XS:XaUSUXS-S-nUS-nO�XS:Xa[RX5nO/XS:Xa[RX5nO[SXS35eUc[S	XS8535eUR5upTUSUXS-US-86-XS-nUR	5S-87nU[U5:�aUR
U5 U$U(aGMmU$)a�Split a string up according to Unix shell-like rules for quotes and88backslashes.  In short: words are delimited by spaces, as long as those89spaces are not escaped by a backslash, or inside a quoted string.90Single and double quotes are equivalent, and the quote characters can91be backslash-escaped.  The backslash is stripped from any two-character92escape sequence, leaving only the escaped character.  The quote93characters are stripped from any quoted string.  Returns a list of94words.95Nr�\r96rK�"zthis can't happen (bad char 'z')zbad string (mismatched z	 quotes?)�)r�r��striprv�end�len�appendr�r��lstripr�r��RuntimeErrorrl�span)rA�words�pos�mr��begs      r�split_quotedr��s������
�	���	�A��E�97�C�98�����'���e�e�g���#�a�&�=��L�L��4�C��!��D�L�A
�6�V�&�&�&�
�L�L��4�C��!��$���� �A��C�
�V�t�^��$�3��!�!�G�I�,�&�A���'�C��v��}��$�$�Q�,����3���$�$�Q�,��"�%B�1�6�(�"�#M�N�N��y� �#:�1�6�(�)�!L�M�M�����J�S��$�3��!�!�G�c�A�g�.�.��4��8�A��%�%�'�A�+�C��#�a�&�=��L�L��O���L�O�!�N�Lrc��Uc"URU<3nUSSS:XaUSSS-n[R"U5 U"U6 g)z�99Perform some action that affects the outside world (e.g. by100writing to the filesystem). Was previously used to deal with101"dry run" operations, but now runs unconditionally.102N�����z,)r�))�__name__r�info)�func�args�msg�verboses    r�executer�7sJ���{������x�(���r�s�8�t���a��)�c�/�C��H�H�S�M��$�Krc�\�UR5nUS;agUS;ag[SU<35e)z�Convert a string representation of truth to true (1) or false (0).103 104True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values105are 'n', 'no', 'f', 'false', 'off', and '0'.  Raises ValueError if106'val' is anything else.107)�y�yes�t�true�on�1T)rB�no�f�false�off�0Fzinvalid truth value )�lowerrl)�vals r�	strtoboolr�Ks:���)�)�+�C�108�2�2��	�5�	5���/��w�7�8�8rc�f�[R(a[S5eUcUS:HnU(Gd)[R"S5upx[109R"SU5 [R"USSS9n	U	 U	RS	5 U	RS110R[[U55S-5 U	RSU<S
U<SU<SU<SU<S35 SSS5 [R/n111U112R[R "55 U113R#U5 [%U1145 ['[R(U4SU35 gSSKJn UGH9nUSSS:waMUS:�a(US:XaSOUn
[.R0R3X�S9nO[.R0R3U5nUnU(a3US[5U5U:wa[7SU<SU<35eU[5U5SnU(a[R8RXO5n[R8R;U5nU(dM�U(d[=X�5(a$[115R"SUU5 U"X�U5 GM![116R>"SUU5 GM< g!,(df   GN�=f)a�Byte-compile a collection of Python source files to .pyc117files in a __pycache__ subdirectory.  'py_files' is a list118of files to compile; any files that don't end in ".py" are silently119skipped.  'optimize' must be one of the following:120  0 - don't optimize121  1 - normal optimization (like "python -O")122  2 - extra optimization (like "python -OO")123If 'force' is true, all files are recompiled regardless of124timestamps.125 126The source filename encoded in each bytecode file defaults to the127filenames listed in 'py_files'; you can modify these with 'prefix' and128'basedir'.  'prefix' is a string that will be stripped off of each129source filename, and 'base_dir' is a directory name that will be130prepended (after 'prefix' is stripped).  You can supply either or both131(or neither) of 'prefix' and 'base_dir', as you wish.132 133Byte-compilation is either done directly in this interpreter process134with the standard py_compile module, or indirectly by writing a135temporary script and executing it.  Normally, you should let136'byte_compile()' figure out to use direct compilation or not (see137the source for details).  The 'direct' flag is used by the script138generated in indirect mode; unless you know what you're doing, leave139it set to None.140zbyte-compiling is disabled.Nrz.pyz$writing byte-compilation script '%s'�wzutf-8)�encodingz2from distutils.util import byte_compile141files = [142z,143z]144z145byte_compile(files, optimize=z, force=z,146         prefix=z, base_dir=z,147         verbose=z,148         direct=True)149z	removing )r������r.)�optimizationzinvalid prefix: filename z doesn't start with zbyte-compiling %s to %sz%skipping byte-compilation of %s to %s) �sys�dont_write_bytecoder
�tempfile�mkstemprr�r"�fdopen�writerN�map�repr�150executable�extend�151subprocess�"_optim_args_from_interpreter_flagsr�rr��remove�152py_compiler��	importlib�util�cache_from_sourcer�rlrL�basenamer�debug)�py_files�optimize�forcer��base_dirr��direct�	script_fd�script_name�script�cmdr��file�opt�cfile�dfile�153cfile_bases                 r�byte_compiler�[sM��H���'�(E�F�F��~�'�1�}���#+�#3�#3�E�#:� �����7��E����9�c�G�<��
��L�L��
�"
�L�L����C��h�$7�8�5�@�A��L�L��&�\��%��;��154�+�h�\�2�����
�'�8�~�~����155�156�:�@�@�B�C��157�158�;��
�c�159���	�	�K�>�Y�{�m�+D�E�	'��D��B�C�y�E�!��160�1�}�$��M�b�x��!���8�8��8�P��!���8�8��>���E���
�#�f�+�&�&�0�$�3�D�8�;O�PV�z�Z����c�&�k�m�,��������X�5�����)�)�%�0�J��v��E�$�.�.��H�H�6��j�I��D��/��I�I�E�t�Z�X�=�S�V�s
�8A)J!�!161J0c��SnURSS9nU=(a USR5SUS:gnU(aUOSnURU5U-$)z�Return a version of the string escaped for inclusion in an162RFC-822 header, by ensuring there are 8 spaces space after each newline.163z        T)�keepends�����rr.)�164splitlinesrN)�header�indent�lines�ends_in_newline�suffixs     r�
rfc822_escaper��s`���F����t��,�E��F��b�	� 4� 4� 6�q� 9�U�2�Y� F�O�&�V�B�F��;�;�u���&�&rc�h�[RS:H=(a [5RS5$)z�Returns True if the current platform is mingw.165 166Python compiled with Mingw-w64 has sys.platform == 'win32' and167get_platform() starts with 'mingw'.168r�mingw)r��platformr�169startswithrrr�is_mingwr��s%���<�<�7�"�I�|�~�'@�'@��'I�Irc�@�[[R"S55$)zKReturn True if the Python interpreter is built with free threading support.�Py_GIL_DISABLED)�boolrr0rrr�is_freethreadedr��s���	�(�(�):�;�<�<r)�returnrb)rArbr�z	list[int])rGzstr | os.PathLike[str]r�rb)rQ�AnyStr | os.PathLike[AnyStr]rGr�r�r)r��None)rmzMapping[str, object]r�rb)zerror: )r��objectr�rbr�rb)rArbr�z	list[str])NF)170r�zCallable[[Unpack[_Ts]], object]r�ztuple[Unpack[_Ts]]r�r�r�r�r�r�)r�rbr�r�)rFNNTN)r�z
Iterable[str]r�r@r�r�r��171str | Noner�r�r�r�r�zbool | Noner�r�)r�rbr�rb)r�r�)>�__doc__�172__future__r�	functools�importlib.utilr�r"rEryr�r�r�rr��collections.abcrrr�typingrr�jaraco.functoolsr	�_logr�	_modifiedr�errorsr
rr�typing_extensionsrrrrrr�r+r1r,r3r<r8rHrS�	lru_cacher]rprjr�r�r�r�r�r�r�r�r�r�r�r�rrr�<module>r�s����#���	��	�
��173���7�7�(�&���E���6�174�u�175�C�$�176��<�<�8����/���177��@*�178�1��1�$N�*�N�6R�N��N�.���,��,�,4�&�(�+/�.�
�.�179�Z�2�<�J��	�180)��181��182���	�183184��(
9�$������BY��BY��BY��BY�
�	BY�185�BY��
BY�
�BY�186�BY�J'�J�=r
codekingpro/portable-devtools · Team Ai