a „oeoã@s:dZddlZddlmZddlmZddlmZmZm Z m Z m Z ddl m Z ddlmZdd lmZe d ƒZeedfZeZe jZee eefe eeeeeeffd œd d „Zee eeefdœdd„Zee eeefe eeeeeeffd œdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Z dS)aSHelper code used to generate ``requires.txt`` files in the egg-info directory. The ``requires.txt`` file has an specific format: - Environment markers need to be part of the section headers and should not be part of the requirement spec itself. See https://setuptools.pypa.io/en/latest/deprecated/python_eggs.html#requires-txt éN)Ú defaultdict)Ú filterfalse)ÚDictÚListÚTupleÚMappingÚTypeVaré)Ú_reqs)Ú yield_lines)Ú RequirementÚ_T)Úinstall_requiresÚextras_requireÚreturncCst|ƒ}t||ƒS)z�Given values for ``install_requires`` and ``extras_require`` create modified versions in a way that can be written in ``requires.txt`` )Ú_convert_extras_requirementsÚ"_move_install_requirements_markers)rrÚextras©rú@C:\Program Files\Certbot\pkgs\setuptools\command\_requirestxt.pyÚ_preparesr)rrcCsLttƒ}| ¡D]6\}}||t |¡D]}||t|ƒ |¡q*q|S)z‘ Convert requirements in `extras_require` of the form `"extra": ["barbazquux; {marker}"]` to `"extra:{marker}": ["barbazquux"]`. )rÚdictÚitemsr ÚparseÚ _suffix_forÚ setdefault)rÚoutputÚsectionÚvÚrrrrr$s rcCsptt |¡ƒ}tt|ƒ}tt|ƒ}ttt|ƒƒ}|D]}|dt|jƒ  |¡q4t dd„|  ¡Dƒƒ}||fS)a+ The ``requires.txt`` file has an specific format: - Environment markers need to be part of the section headers and should not be part of the requirement spec itself. Move requirements in ``install_requires`` that are using environment markers ``extras_require``. ú:c ss4|],\}}|tt dd„tt|ƒDƒ¡ƒfVqdS)css|]}t|ƒVqdS©N)Ústr)Ú.0rrrrÚ Oóz?_move_install_requirements_markers...N)ÚlistrÚfromkeysÚmapÚ _clean_req)r#Úkrrrrr$Msÿz5_move_install_requirements_markers..) r&r rÚfilterÚ _no_markerrr(r"Úmarkerrrr)rrZ inst_reqsZ simple_reqsZ complex_reqsZsimple_install_requiresrZexpanded_extrasrrrr6s  ýrcCs|jrdt|jƒSdS)z;Return the 'extras_require' suffix for a given requirement.r Ú)r-r"©ÚreqrrrrVsrcCstt|ƒƒ}d|_|S)z=Given a Requirement, remove environment markers and return itN)r r"r-)r0rrrrr)[s r)cCs|j Sr!)r-r/rrrr,bsr,cCs,t|pdƒ}dd„}t||ƒ}| |¡dS)NrcSs|dS)NÚ r)ÚlinerrrÚ append_crisz&_write_requirements..append_cr)r r(Ú writelines)ÚstreamZreqsÚlinesr3rrrÚ_write_requirementsfs  r7cCs||j}t ¡}t|jpd|jp iƒ\}}t||ƒt|ƒD]*}| dj fit ƒ¤Ž¡t|||ƒq:|  d||  ¡¡dS)Nrz [{extra}] Z requirements) Ú distributionÚioÚStringIOrrrr7ÚsortedÚwriteÚformatÚvarsÚwrite_or_delete_fileÚgetvalue)ÚcmdÚbasenameÚfilenameZdistÚdatarrZextrarrrÚwrite_requirementspsÿ  rEcCs,t ¡}t||jjƒ| d|| ¡¡dS)Nzsetup-requirements)r9r:r7r8Zsetup_requiresr?r@)rArBrCrDrrrÚwrite_setup_requirements}srF)!Ú__doc__r9Ú collectionsrÚ itertoolsrÚtypingrrrrrr.r Zextern.jaraco.textr Zextern.packaging.requirementsr r Z_OrderedrZ_orderedZ _StrOrIterr"rrrrr)r,r7rErFrrrrÚs4       þ þ þ