U v_2%@sdZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZmZmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZerddlmZm Z m!Z!m"Z"m#Z#m$Z$ddl%m&Z&ddl'm(Z(e e(ge)fZ*e$e"e(e"e(fZ+e,e-Z.e/dej0Z1ddZ2ddZ3ddZ4ddZ5ddZ6ddZ7ddZ8d d!Z9d"d#Z:d$d%Z;d&d'ZdS||sXtd|jdS|jsvtsvtd|jdSdS)zBReturn whether an InstallRequirement should be built into a wheel.Fz(Skipping %s, due to already being wheel.TzCSkipping wheel build for %s, due to binaries being disabled for it.zOUsing legacy 'setup.py install' for %s, since package 'wheel' is not installed.) constraintis_wheelloggerinfonameeditable source_dir use_pep517r)req need_wheelcheck_binary_allowedrrr _should_build.s4  r)cCst|dtdS)NTr'r()r) _always_true)r&rrrshould_build_for_wheel_command[s r,cCst|d|dS)NFr*)r))r&r(rrr should_build_for_install_commandds r-cCs|js |jsdS|jrb|jjrb|jr(t|js2tt|jj}|sHt||jj |jr^dSdS|jslt|j \}}t |rdSdS)z Return whether a built InstallRequirement can be stored in the persistent wheel cache, assuming the wheel cache is available, and _should_build() has determined a wheel needs to be built. FT) r#r$linkis_vcsAssertionErrorrget_backend_for_schemeschemeis_immutable_rev_checkouturlsplitextr)r& vcs_backendbaseextrrr _should_cachens    r9cCs>t|j}|jst|r.t|r.||j}n ||j}|S)zdReturn the persistent or temporary cache directory where the built wheel need to be stored. )r cache_dirr.r0r9get_path_for_linkget_ephem_path_for_link)r& wheel_cachecache_availabler:rrr_get_cache_dirs     r?cCsdS)NTr)_rrrr+sr+c Csrz t|Wn8tk rD}ztd|j|WYdSd}~XYnX|jt||||W5QRSQRXdS)zaBuild one wheel. :return: The filename of the built wheel, or None if the build failed. Building wheel for %s failed: %sN)rOSErrorr warningr" build_env_build_one_inside_env)r& output_dir build_optionsglobal_optionserrr _build_ones  rJc Cs2tdd}|jst|jrD|js(tt|j|j|j||jd}nt|j|j |j |||jd}|dk rt j |}t j ||}zNt|\}} t||td|j|| |td||WW5QRStk r} ztd|j| W5d} ~ XYnX|jst||W5QRdSQRXdS)Nwheel)kind)r"backendmetadata_directoryrGtempd)r" setup_py_pathr$rHrGrOz3Created wheel for %s: filename=%s size=%d sha256=%szStored in directory: %srA)r r"r0r%rNrpep517_backendpathrrPunpacked_source_directoryosbasenamejoinrshutilmover r! hexdigest ExceptionrC_clean_one_legacy) r&rFrGrHtemp_dir wheel_path wheel_name dest_path wheel_hashlengthrIrrrrEsT        rEcCsZt|j|d}td|jzt||jdWdStk rTtd|jYdSXdS)N)rHzRunning setup.py clean for %s)cwdTz Failed cleaning build dir for %sF) r rPr r!r"r r$rZerror)r&rH clean_argsrrrr[sr[c Cs|s ggfStdddd|Dtpgg}}|D]Z}t||}t||||}|rtt||_|jj |_ |jj st | |q>| |q>W5QRX|rtdddd|D|rtd dd d|D||fS) zBuild wheels. :return: The list of InstallRequirement that succeeded to build and the list of InstallRequirement that failed to build. z*Building wheels for collected packages: %sz, css|] }|jVqdS)Nr".0r&rrr szbuild..zSuccessfully built %s cSsg|] }|jqSrrerfrrr ,szbuild..zFailed to build %scSsg|] }|jqSrrerfrrrrj1s)r r!rVrr?rJrr r. file_pathlocal_file_pathrr0append) requirementsr=rGrHbuild_successesbuild_failuresr&r: wheel_filerrrbuildsB      rr)=__doc__loggingos.pathrTrerWpip._internal.models.linkr$pip._internal.operations.build.wheelr+pip._internal.operations.build.wheel_legacyrpip._internal.utils.loggingrpip._internal.utils.miscrrr$pip._internal.utils.setuptools_buildr pip._internal.utils.subprocessr pip._internal.utils.temp_dirr pip._internal.utils.typingr pip._internal.utils.urlsr pip._internal.vcsrtypingrrrrrrpip._internal.cacherZpip._internal.req.req_installrrZBinaryAllowedPredicateZ BuildResult getLogger__name__r compile IGNORECASErrr)r,r-r9r?r+rJrEr[rrrrrrsD               -  !3