관리-도구
편집 파일: config.cpython-39.pyc
a �������f�T����������������������@���s��d�dl�Z�d�dlZd�dlZd�dlZd�dlZd�dlZd�dlZd�dlmZ�d�dlm Z �d�dlm Z �d�dlZd�dlm Z mZ�d�dlmZmZ�d�dlmZ�G�dd ��d �Zejd d���Zdd d�Zdd��Zdd��Zddd�ZG�dd��d�ZG�dd��de�ZG�dd��de�ZdS�)�����N)�defaultdict)�partial��wraps)�DistutilsOptionError�DistutilsFileError)� LegacyVersion�parse)�SpecifierSetc�������������������@���s ���e�Zd�ZdZdd��Zdd��ZdS�)�StaticModulez0 Attempt to load the module by the name c�����������������C���s`���t�j�|�}t|j��}|���}W�d�����n1�s40����Y��t�|�}t|��� t ����|�`d�S��N)� importlib�util� find_spec�open�origin�read�astr ����vars�update�locals�self)r����name�specZstrm�src�module��r����5/usr/lib/python3.9/site-packages/setuptools/config.py�__init__���s����& zStaticModule.__init__c�������������� ������s^���zt���fdd�|�jjD���W�S��tyX�}�z$tdjf�i�t�����|�W�Y�d�}~n d�}~0�0�d�S�)Nc�����������������3���sH���|�]@}t�|tj�r|jD�](}t�|tj�r|j��krt�|j�V��qqd�S�r���)� isinstancer���ZAssign�targets�Name�idZliteral_eval�value)�.0Z statement�target��attrr���r���� <genexpr>!���s ��� �z+StaticModule.__getattr__.<locals>.<genexpr>z#{self.name} has no attribute {attr})�nextr����body� Exception�AttributeError�formatr���)r���r'����er���r&���r����__getattr__���s����� ��zStaticModule.__getattr__N)�__name__� __module__�__qualname__�__doc__r���r/���r���r���r���r���r������s���r���c�������������� ���c���s8���z$t�j�d|���dV��W�t�j�|���nt�j�|���0�dS�)zH Add path to front of sys.path for the duration of the context. r���N)�sys�path�insert�remove)r5���r���r���r���� patch_path.���s����r8���Fc����������� ��� ���C���s����ddl�m}m}�tj�|��}�tj�|��s4td|����t���}t� tj� |����zT|��}|rb|���ng�}|�|vrx|�|���|j ||d��t||j|d�}W�t� |��nt� |��0�t|�S�)a,��Read given configuration file and returns options from it as a dict. :param str|unicode filepath: Path to configuration file to get options from. :param bool find_others: Whether to search for other configuration files which could be on in various places. :param bool ignore_option_errors: Whether to silently ignore options, values of which could not be resolved (e.g. due to exceptions in directives such as file:, attr:, etc.). If False exceptions are propagated as expected. :rtype: dict r���)�Distribution� _Distributionz%Configuration file %s does not exist.)� filenames)�ignore_option_errors)Zsetuptools.distr9���r:����osr5����abspath�isfiler����getcwd�chdir�dirnameZfind_config_files�appendZparse_config_files�parse_configuration�command_options�configuration_to_dict) �filepathZfind_othersr<���r9���r:���Zcurrent_directoryZdistr;����handlersr���r���r����read_configuration:���s(����� �rI���c�����������������C���s2���dj�f�i�t����}t�t|�|�}t|�||�}|��S�)z� Given a target object and option key, get that option from the target object, either through a get_{key} method or from an attribute directly. z get_{key})r-���r���� functoolsr����getattr)� target_obj�keyZgetter_nameZby_attribute�getterr���r���r����_get_optioni���s����rO���c�����������������C���s<���t�t�}|�D�]*}|jD�]}t|j|�}|||j�|<�qq|S�)z�Returns configuration data gathered by given handlers as a dict. :param list[ConfigHandler] handlers: Handlers list, usually from parse_configuration() :rtype: dict )r����dict�set_optionsrO���rL����section_prefix)rH���Zconfig_dictZhandler�optionr#���r���r���r���rF���u���s���� rF���c�����������������C���s6���t�|�||�}|����t|�j|||�j�}|����||fS�)a���Performs additional parsing of configuration options for a distribution. Returns a list of used option handlers. :param Distribution distribution: :param dict command_options: :param bool ignore_option_errors: Whether to silently ignore options, values of which could not be resolved (e.g. due to exceptions in directives such as file:, attr:, etc.). If False exceptions are propagated as expected. :rtype: list )�ConfigOptionsHandlerr ����ConfigMetadataHandler�metadata�package_dir)ZdistributionrE���r<����options�metar���r���r���rD�������s������rD���c�������������������@���s����e�Zd�ZdZdZi�Zd%dd�Zedd���Zdd ��Z e d&dd��Ze d d���Ze dd���Z e dd���Ze dd���Zedd���Zedd���Ze d'dd��Ze dd���Ze d(dd��Zdd ��Zd!d"��Zd#d$��ZdS�))� ConfigHandlerz1Handles metadata supplied in configuration files.NFc�����������������C���s^���i�}|�j�}|���D�].\}}|�|�s&q|�|d��d�}|||<�q||�_||�_||�_g�|�_d�S�)N���.) rR����items� startswith�replace�stripr<���rL����sectionsrQ���)r���rL���rX���r<���ra���rR����section_name�section_optionsr���r���r���r�������s���� zConfigHandler.__init__c�����������������C���s���t�d|�jj���dS�)�.Metadata item name to parser function mapping.z!%s must provide .parsers propertyN)�NotImplementedError� __class__r0���)r���r���r���r����parsers����s���� �zConfigHandler.parsersc����������� ������C���s����t���}|�j}|�j�||�}t|||�}||u�r6t|��|r>d�S�d}|�j�|�}|r~z||�}W�n�ty|���d}|�jsx��Y�n0�|r�d�S�t|d|�d��}|d�u�r�t |||��n||��|�j �|��d�S�)NFTzset_%s)�tuplerL����aliases�getrK����KeyErrorrg���r+���r<����setattrrQ���rC���) r���Zoption_namer#����unknownrL���Z current_valueZskip_option�parser�setterr���r���r����__setitem__����s0����zConfigHandler.__setitem__�,c�����������������C���s8���t�|t�r|S�d|v�r |���}n |�|�}dd��|D��S�)z�Represents value as a list. Value is split either by separator (defaults to comma) or by lines. :param value: :param separator: List items separator character. :rtype: list � c�����������������S���s���g�|�]}|����r|�����qS�r���)r`���)r$����chunkr���r���r���� <listcomp>��������z-ConfigHandler._parse_list.<locals>.<listcomp>)r����list� splitlines�split)�clsr#���� separatorr���r���r����_parse_list����s���� zConfigHandler._parse_listc�����������������C���sP���d}i�}|���|�D�]8}|�|�\}}}||kr:td|���|���||���<�q|S�)zPRepresents value as a dict. :param value: :rtype: dict �=z(Unable to parse option value to dict: %s)r{���� partitionr���r`���)ry���r#���rz����result�linerM����sep�valr���r���r����_parse_dict��s�����zConfigHandler._parse_dictc�����������������C���s���|����}|dv�S�)zQRepresents value as boolean. :param value: :rtype: bool )�1�trueZyes)�lower)ry���r#���r���r���r����_parse_bool��s����zConfigHandler._parse_boolc��������������������s�����fdd�}|S�)z�Returns a parser function to make sure field inputs are not files. Parses a value after getting the key so error messages are more informative. :param key: :rtype: callable c��������������������s ���d}|���|�rtd������|�S�)N�file:zCOnly strings are accepted for the {0} field, files are not accepted)r^���� ValueErrorr-���)r#���Zexclude_directive�rM���r���r���rn���)��s���� ��z3ConfigHandler._exclude_files_parser.<locals>.parserr���)ry���rM���rn���r���r����r����_exclude_files_parser��s����z#ConfigHandler._exclude_files_parserc��������������������s\���d}t�|t�s|S�|�|�s |S�|t|�d��}dd��|�d�D��}d���fdd�|D���S�)aO��Represents value as a string, allowing including text from nearest files using `file:` directive. Directive is sandboxed and won't reach anything outside directory with setup.py. Examples: file: README.rst, CHANGELOG.md, src/file.txt :param str value: :rtype: str r����Nc�����������������s���s���|�]}t�j�|����V��qd�S�r���)r=���r5���r>���r`����r$���r5���r���r���r���r(���I��ru���z,ConfigHandler._parse_file.<locals>.<genexpr>rq���rr���c�����������������3���s.���|�]&}����|�stj�|�r���|�V��qdS�)TN)� _assert_localr=���r5���r?���� _read_filer�����ry���r���r���r(���J��s��� �)r����strr^����lenrx����join)ry���r#���Zinclude_directiver���Z filepathsr���r����r����_parse_file2��s���� �zConfigHandler._parse_filec�����������������C���s���|���t����std|����d�S�)Nz#`file:` directive can not access %s)r^���r=���r@���r���)rG���r���r���r���r����Q��s�����zConfigHandler._assert_localc�����������������C���s:���t�j|�dd��}|���W��d�����S�1�s,0����Y��d�S�)Nzutf-8)�encoding)�ior���r���)rG����fr���r���r���r����W��s����zConfigHandler._read_filec�������������� ���C���s4��d}|��|�s|S�|�|d�����d�}|���}d�|�}|p@d}t���}|r�|d�|v�r�||d��}|�dd�} t | �dkr�tj �t���| d��}| d�}q�|}nd|v�r�tj �t���|d��}t|��N�ztt |�|�W�W��d����S��t�y���t�|�} Y�n0�W�d����n1��s 0����Y��t| |�S�) z�Represents value as a module attribute. Examples: attr: package.attr attr: package.module.attr :param str value: :rtype: str zattr:r[���r\���r���r����/����N)r^���r_���r`���rx����popr����r=���r@����rsplitr����r5���r8���rK���r���r+���r ���� import_module)ry���r#���rW���Zattr_directiveZ attrs_pathZ attr_nameZmodule_name�parent_pathZcustom_path�partsr���r���r���r����_parse_attr\��s0���� 0zConfigHandler._parse_attrc��������������������s�����fdd�}|S�)z�Returns parser function to represents value as a list. Parses a value applying given methods one after another. :param parse_methods: :rtype: callable c��������������������s���|�}��D�]}||�}q|S�r���r���)r#����parsed�method�� parse_methodsr���r���r ������s���� z1ConfigHandler._get_parser_compound.<locals>.parser���)ry���r����r ���r���r����r����_get_parser_compound���s���� z"ConfigHandler._get_parser_compoundc�����������������C���s6���i�}|pdd��}|����D�]\}\}}||�||<�q|S�)z�Parses section options into a dictionary. Optionally applies a given parser to values. :param dict section_options: :param callable values_parser: :rtype: dict c�����������������S���s���|�S�r���r���)r����r���r���r����<lambda>���ru���z6ConfigHandler._parse_section_to_dict.<locals>.<lambda>)r]���)ry���rc���Z values_parserr#���rM����_r����r���r���r����_parse_section_to_dict���s ���� z$ConfigHandler._parse_section_to_dictc�������������� ���C���s:���|����D�],\}\}}z||�|<�W�q�ty2���Y�q0�qdS�)zQParses configuration file section. :param dict section_options: N)r]���rk���)r���rc���r���r����r#���r���r���r���� parse_section���s ����zConfigHandler.parse_sectionc�����������������C���sb���|�j����D�]R\}}d}|r"d|�}t|�d|��dd�d�}|du�rTtd|�j|f���||��q dS�)zTParses configuration file items from one or more related sections. r[���z_%szparse_section%sr\����__Nz0Unsupported distribution option section: [%s.%s])ra���r]���rK���r_���r���rR���)r���rb���rc���Zmethod_postfixZsection_parser_methodr���r���r���r ������s �������zConfigHandler.parsec��������������������s���t��������fdd��}|S�)z� this function will wrap around parameters that are deprecated :param msg: deprecation message :param warning_class: class of warning exception to be raised :param func: function to be wrapped around c���������������������s���t��������|�i�|��S�r���)�warnings�warn)�args�kwargs��func�msg� warning_classr���r����config_handler���s����z@ConfigHandler._deprecated_config_handler.<locals>.config_handlerr���)r���r����r����r����r����r���r����r����_deprecated_config_handler���s����z(ConfigHandler._deprecated_config_handler)F)rq���)N)N)r0���r1���r2���r3���rR���ri���r����propertyrg���rp����classmethodr{���r����r����r����r�����staticmethodr����r����r����r����r����r����r ���r����r���r���r���r���rZ�������s<��� & - rZ���c�����������������������sH���e�Zd�ZdZddddd�ZdZd��fd d � Zedd���Zd d��Z ���Z S�)rU���rV����url�description�classifiers� platforms)Z home_pageZsummaryZ classifier�platformFNc��������������������s���t�t|���|||��||�_d�S�r���)�superrU���r���rW���)r���rL���rX���r<���rW����rf���r���r���r������s�����zConfigMetadataHandler.__init__c�����������������C���s^���|�j�}|�j}|�j}|�j}||||��|dt�||��||�|d�|��|d�dt�||||�j|d� S�)rd���z[The requires parameter is deprecated, please use install_requires for runtime dependencies.�license�license_filezDThe license_file parameter is deprecated, use license_files instead.) r�����keywordsZprovidesZrequiresZ obsoletesr����r����r����Z license_filesr����Zlong_description�versionZproject_urls)r{���r����r����r����r�����DeprecationWarningr�����_parse_version)r���� parse_listZ parse_file� parse_dictZexclude_files_parserr���r���r���rg������s4����� ��zConfigMetadataHandler.parsersc�����������������C���s����|���|�}||krF|���}tt|�t�rBd}t|jf�i�t������|S�|��||�j �}t |�rb|��}t|t�s�t|d�r�d� tt|��}nd|�}|S�)zSParses `version` option value. :param value: :rtype: str zCVersion loaded from {value} does not comply with PEP 440: {version}�__iter__r\���z%s)r����r`���r���r ���r���r���r-���r���r����rW����callabler�����hasattrr�����map)r���r#���r����Ztmplr���r���r���r������s ���� � z$ConfigMetadataHandler._parse_version)FN)r0���r1���r2���rR���ri���Zstrict_moder���r����rg���r����� __classcell__r���r���r����r���rU������s������� rU���c�������������������@���s\���e�Zd�ZdZedd���Zdd��Zdd��Zdd ��Zd d��Z dd ��Z dd��Zdd��Zdd��Z dS�)rT���rX���c�����������������C���sN���|�j�}t|�j�dd�}|�j}|�j}|||||||||||||||�j|�j|td�S�)rd����;�rz���)Zzip_safeZuse_2to3Zinclude_package_datarW���Zuse_2to3_fixersZuse_2to3_exclude_fixersZconvert_2to3_doctestsZscriptsZeager_resourcesZdependency_linksZnamespace_packagesZinstall_requiresZsetup_requiresZ tests_requireZpackages�entry_pointsZ py_modulesZpython_requires)r{���r���r����r�����_parse_packagesr����r ���)r���r����Zparse_list_semicolonZ parse_boolr����r���r���r���rg���?��s.�����zConfigOptionsHandler.parsersc�����������������C���sn���ddg}|����}||vr"|��|�S�||d�k}|��|�j�di���}|rTddlm}�nddlm}�|f�i�|��S�)zTParses `packages` option value. :param value: :rtype: list zfind:zfind_namespace:r����z packages.findr���)�find_namespace_packages)� find_packages)r`���r{����parse_section_packages__findra���rj���Z setuptoolsr����r����)r���r#���Zfind_directivesZ trimmed_valueZfindns�find_kwargsr����r���r���r���r����\��s���� �z$ConfigOptionsHandler._parse_packagesc��������������������sR���|���||�j�}g�d���t��fdd�|���D���}|�d�}|durN|d�|d<�|S�)z�Parses `packages.find` configuration file section. To be used in conjunction with _parse_packages(). :param dict section_options: )�whereZincludeZexcludec��������������������s$���g�|�]\}}|��v�r|r||f�qS�r���r����r$����k�v�Z valid_keysr���r���rt������ru���zEConfigOptionsHandler.parse_section_packages__find.<locals>.<listcomp>r����Nr���)r����r{���rP���r]���rj���)r���rc���Zsection_datar����r����r���r����r���r����u��s������ z1ConfigOptionsHandler.parse_section_packages__findc�����������������C���s���|���||�j�}||�d<�dS�)z`Parses `entry_points` configuration file section. :param dict section_options: r����N)r����r{����r���rc���r����r���r���r����parse_section_entry_points���s����z/ConfigOptionsHandler.parse_section_entry_pointsc�����������������C���s.���|���||�j�}|�d�}|r*||d<�|d=�|S�)N�*r[���)r����r{���rj���)r���rc���r�����rootr���r���r����_parse_package_data���s���� z(ConfigOptionsHandler._parse_package_datac�����������������C���s���|���|�|�d<�dS�)z`Parses `package_data` configuration file section. :param dict section_options: Zpackage_dataN�r�����r���rc���r���r���r����parse_section_package_data���s����z/ConfigOptionsHandler.parse_section_package_datac�����������������C���s���|���|�|�d<�dS�)zhParses `exclude_package_data` configuration file section. :param dict section_options: Zexclude_package_dataNr����r����r���r���r����"parse_section_exclude_package_data���s�����z7ConfigOptionsHandler.parse_section_exclude_package_datac�����������������C���s"���t�|�jdd�}|��||�|�d<�dS�)zbParses `extras_require` configuration file section. :param dict section_options: r����r����Zextras_requireN)r���r{���r����)r���rc���r����r���r���r����parse_section_extras_require���s�����z1ConfigOptionsHandler.parse_section_extras_requirec�����������������C���s(���|���||�j�}dd��|���D��|�d<�dS�)z^Parses `data_files` configuration file section. :param dict section_options: c�����������������S���s���g�|�]\}}||f�qS�r���r���r����r���r���r���rt������ru���zAConfigOptionsHandler.parse_section_data_files.<locals>.<listcomp>Z data_filesN)r����r{���r]���r����r���r���r����parse_section_data_files���s����z-ConfigOptionsHandler.parse_section_data_filesN)r0���r1���r2���rR���r����rg���r����r����r����r����r����r����r����r����r���r���r���r���rT���;��s��� rT���)FF)F)r���r����r=���r4���r����rJ���r ����collectionsr���r���r���� contextlibZdistutils.errorsr���r���Z#setuptools.extern.packaging.versionr���r ���Z&setuptools.extern.packaging.specifiersr ���r����contextmanagerr8���rI���rO���rF���rD���rZ���rU���rT���r���r���r���r����<module>���s6��� �� /�� ��@[