U n av%@sdZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZmZmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZerddlmZm Z m!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/e0dej1fddZ2ddZ3ddZ4ddZ5ddZ6ddZ7ddZ8d 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.zMUsing legacy setup.py install for %s, since package 'wheel' is not installed.) constraintis_wheelloggerinfonameeditable source_dir use_pep517r)req need_wheelcheck_binary_allowedrrr _should_build0s4  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_commandfs r.cCst|tdsdS|jrb|jjrb|jr(t|js2tt|jj }|sHt| |jj |jr^dSdS|j \}}t |r|dSdS)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. )r)FT)r.r,linkis_vcsr$AssertionErrorr%rget_backend_for_schemeschemeis_immutable_rev_checkouturlsplitextr)r' vcs_backendbaseextrrr _should_cacheps"   r:cCs4t|j}|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:get_path_for_linkr/get_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  rKc Cstdd}|jr0t|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_directoryrHtempd)r# setup_py_pathr%rIrHrPz3Created wheel for %s: filename=%s size=%d sha256=%szStored in directory: %srB)r r&rr#pep517_backendrOpathrrQunpacked_source_directoryosbasenamejoinrshutilmover!r" hexdigest ExceptionrD_clean_one_legacy) r'rGrHrItemp_dir wheel_path wheel_name dest_path wheel_hashlengthrJrrrrFsP      rFcCsZt|j|d}td|jzt||jdWdStk rTtd|jYdSXdS)N)rIzRunning setup.py clean for %s)cwdTz Failed cleaning build dir for %sF) r rQr!r"r#r r%r[error)r'rI 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|] }|jqSrrfrgrrr -szbuild..zFailed to build %scSsg|] }|jqSrrfrgrrrrk2s)r!r"rWrr@rKrr r/ file_pathlocal_file_pathr r1append) requirementsr>rHrIbuild_successesbuild_failuresr'r; wheel_filerrrbuildsB      rs)=__doc__loggingos.pathrUrerXpip._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.vcsrtypingrrrrrrrpip._internal.cacherZpip._internal.req.req_installrrZBinaryAllowedPredicateZ BuildResult getLogger__name__r!compileIrr*r-r.r:r@r,rKrFr\rsrrrrsD          $    -  #1