a
    £XhÖ  ã                   @   s  d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	mZ
 ddlmZ ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZmZ ddlmZ erÌddlmZ ddlmZmZm Z m!Z! e "d¡Z#dd„ Z$dd„ Z%ej&dd… dkpe '¡  (¡ dkZ)dZ*e)re
 +¡ Z*n
e ,d¡Z*ze -¡ Z.W n e/yN   ej0Z.Y n0 er¢ej1 2ej3d¡Z4ej1 2e.d¡Z5ej1 6e4¡sìej1 2ej3d¡Z4ej1 2e.d¡Z5nJej1 2ej3d¡Z4ej1 2e.d¡Z5ejdd… dkrìej3dd… dkrìdZ4d#dd „Z7d$d!d"„Z8dS )%z7Locations where we look for configs, install stuff, etcé    )Úabsolute_importN)Ú	sysconfig)ÚSCHEME_KEYS)Úinstall)ÚScheme)Úappdirs)ÚWINDOWS)ÚMYPY_CHECK_RUNNINGÚcast)Úrunning_under_virtualenv)ÚCommand)ÚDictÚListÚOptionalÚUnionÚpipc                   C   s   dj tjŽ S )ze
    Return the major-minor version of the current Python as a string, e.g.
    "3.7" or "3.10".
    z{}.{})ÚformatÚsysÚversion_info© r   r   ú\/var/www/viveiro_mudafortebrasil/venv/lib/python3.9/site-packages/pip/_internal/locations.pyÚget_major_minor_version!   s    r   c                  C   sX   t ƒ rtj tjd¡} n4ztj t ¡ d¡} W n tyJ   t d¡ Y n0 tj 	| ¡S )NÚsrcz=The folder you are executing pip from can no longer be found.)
r   ÚosÚpathÚjoinr   ÚprefixÚgetcwdÚOSErrorÚexitÚabspath)Ú
src_prefixr   r   r   Úget_src_prefix*   s    ÿ
r"   é   )r#   é   ÚpypyÚpurelibZScriptsÚbiné   Údarwiné   z/System/Library/z/usr/local/binFc                 C   s„  ddl m} d| i}|r"dg|d< ||ƒ}| ¡  d}	|jddd	}	|	dusPJ ‚tt|	ƒ}
|rr|rrJ d
 ||¡ƒ‚|rŠ|rŠJ d ||¡ƒ‚|p’|
j|
_|sž|r¤d|
_|p¬|
j|
_|p¸|
j	|
_	|pÄ|
j
|
_
|
 ¡  i }tD ]}t|
d| ƒ||< qØd| d¡v r| t|
j|
jd¡ tƒ r€tj |
jddd tƒ ¡| ¡|d< |dur€tj tj |d ¡¡d }tj ||dd… ¡|d< |S )z+
    Return a distutils install scheme
    r   )ÚDistributionÚnamez--no-user-cfgÚscript_argsNr   T)Úcreatezuser={} prefix={}zhome={} prefix={}Ú Úinstall_Úinstall_lib)r&   ÚplatlibÚincludeÚsitezpython{}Úheadersé   )Údistutils.distr+   Úparse_config_filesÚget_command_objr
   Údistutils_install_commandr   Úuserr   ÚhomeÚrootÚfinalize_optionsr   ÚgetattrÚget_option_dictÚupdateÚdictr1   r   r   r   r   r   Ú
splitdriver    )Ú	dist_namer;   r<   r=   Úisolatedr   r+   Ú	dist_argsÚdÚobjÚiÚschemeÚkeyÚpath_no_driver   r   r   Údistutils_schemed   sV    


û
ÿÿ
þrM   c                 C   s8   t | |||||ƒ}t|d |d |d |d |d dS )a;  
    Get the "scheme" corresponding to the input parameters. The distutils
    documentation provides the context for the available schemes:
    https://docs.python.org/3/install/index.html#alternate-installation

    :param dist_name: the name of the package to retrieve the scheme for, used
        in the headers scheme path
    :param user: indicates to use the "user" scheme
    :param home: indicates to use the "home" scheme and provides the base
        directory for the same
    :param root: root under which other directories are re-based
    :param isolated: equivalent to --no-user-cfg, i.e. do not consider
        ~/.pydistutils.cfg (posix) or ~/pydistutils.cfg (non-posix) for
        scheme paths
    :param prefix: indicates to use the "prefix" scheme and provides the
        base directory for the same
    r2   r&   r5   ÚscriptsÚdata)r2   r&   r5   rN   rO   )rM   r   )rD   r;   r<   r=   rE   r   rJ   r   r   r   Ú
get_scheme¤   s    ÿûrP   )FNNFN)FNNFN)9Ú__doc__Ú
__future__r   r   Úos.pathÚplatformr4   r   r   Ú	distutilsÚdistutils_sysconfigÚdistutils.command.installr   r   r:   Úpip._internal.models.schemer   Zpip._internal.utilsr   Úpip._internal.utils.compatr   Úpip._internal.utils.typingr	   r
   Úpip._internal.utils.virtualenvr   Údistutils.cmdr   ZDistutilsCommandÚtypingr   r   r   r   Úuser_cache_dirÚUSER_CACHE_DIRr   r"   r   Úpython_implementationÚlowerÚcan_not_depend_on_purelibÚsite_packagesÚget_python_libÚget_pathÚgetusersitepackagesÚ	user_siteÚAttributeErrorÚ	USER_SITEr   r   r   Úbin_pyÚbin_userÚexistsrM   rP   r   r   r   r   Ú<module>   sd   
	þ

( ÿ
B     ú