U ʗRe1@sdZddlZddlZddlZddlZddlmZmZm Z m Z m Z m Z ddl mZmZddlmZmZddlmZddlmZmZddlmZmZdd lmZdd lmZdd lm Z dd l!m"Z"dd l#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*m+Z+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6e7e8Z9e:dej;Ze e e&e e&fZ?e@e=dddZAe&e=e>e=dddZBe&e=dddZCe&e>e=d d!d"ZDe&e e=dd#d$ZEe&ee@d%d&d'ZFee=d(d)d*ZGe&e@dd+d,d-ZHe&e@e=e e@e e@e=e e@d.d/d0ZIe&e@e e@e e@e=e e@d1d2d3ZJe&e e@e=d4d5d6ZKe e&ee=e e@e e@e?d7d8d9ZLdS):z;Orchestrator for building wheels from InstallRequirements. N)AnyCallableIterableListOptionalTuple)canonicalize_namecanonicalize_version)InvalidVersionVersion) WheelCache)InvalidWheelFilenameUnsupportedWheel)FilesystemWheelget_wheel_distribution)Link)Wheel)build_wheel_pep517)build_wheel_editable)build_wheel_legacy)InstallRequirement) indent_log) ensure_dir hash_fileis_wheel_installed)make_setuptools_clean_args)call_subprocess) TempDirectory) path_to_url)vcsz([a-z0-9_.]+)-([a-z0-9_.!+-]+))sreturncCstt|S)zjDetermine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1 )bool _egg_info_research)r r%/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/wheel_builder.py_contains_egg_info&sr')req need_wheelcheck_binary_allowedr!cCs|jr dS|jr&|r"td|jdS|r.dS|js8dS|jrF|S|jrPdS||sjtd|jdSt std|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_wheelloggerinfoname source_direditablesupports_pyproject_editable use_pep517r)r(r)r*r%r%r& _should_build.s<r4)r(r!cCst|dtdS)NTr)r*)r4 _always_true)r(r%r%r&should_build_for_wheel_commandcsr7)r(r*r!cCst|d|dS)NFr5)r4)r(r*r%r%r& should_build_for_install_commandis r8cCs|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) r1r0linkis_vcsAssertionErrorrget_backend_for_schemeschemeis_immutable_rev_checkouturlsplitextr')r( vcs_backendbaseextr%r%r& _should_cachers    rD)r( wheel_cacher!cCs>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_dirr9r;rDget_path_for_linkget_ephem_path_for_link)r(rEcache_availablerFr%r%r&_get_cache_dirs     rJ)_r!cCsdS)NTr%)rKr%r%r&r6sr6)r( wheel_pathr!c Cst|jp d}ttj|}t|j|kr>td||jtt ||}t |j }t |t |j krztd||j |j }|dkrtdz t|}Wn&tk rd|}t|YnX|tdkrt|j tstd|dS)Nz7Wheel has unexpected file name: expected {!r}, got {!r}zMissing Metadata-VersionzInvalid Metadata-Version: z1.2z6Metadata 1.2 mandates PEP 440 version, but {!r} is not)rr/rospathbasenamer formatrrstrversionr metadata_versionrr r isinstance) r(rLcanonical_namewdist dist_verstrmetadata_version_valuerTmsgr%r%r& _verify_ones@   r\)r( output_dirverify build_optionsglobal_optionsr1r!c Cs|rdnd}z t|Wn:tk rR}ztd||j|WYdSd}~XYnX|jt|||||}W5QRX|r|rzt||Wn>tt fk r}ztd||j|WYdSd}~XYnX|S)zaBuild one wheel. :return: The filename of the built wheel, or None if the build failed. r1wheelzBuilding %s for %s failed: %sNzBuilt %s for %s is invalid: %s) rOSErrorr-warningr/ build_env_build_one_inside_envr\r r) r(r]r^r_r`r1artifacterLr%r%r& _build_ones4  rh)r(r]r_r`r1r!c Cs|tddf}|jst|jr|js(t|js2t|rDtd|j|rVtd|j|rtt|j|j|j|j d}qt |j|j|j|j d}nt |j|j |j |||j d}|dk rRtj |}tj ||}zNt|\} } t||td|j|| | td||WW5QRStk rP} ztd |j| W5d} ~ XYnX|jsdt||W5QRdSQRXdS) Nra)kindz7Ignoring --global-option when building %s using PEP 517z6Ignoring --build-option when building %s using PEP 517)r/backendmetadata_directorytempd)r/ setup_py_pathr0r`r_rlz3Created wheel for %s: filename=%s size=%d sha256=%szStored in directory: %sz Building wheel for %s failed: %s)rr/r;r3rkpep517_backendr-rcrrOrrrmunpacked_source_directoryrNrPjoinrshutilmover. hexdigest Exception_clean_one_legacy) r(r]r_r`r1temp_dirrL wheel_name dest_path wheel_hashlengthrgr%r%r&resx         re)r(r`r!cCs\t|j|d}td|jzt|d|jdWdStk rVtd|jYdSXdS)N)r`zRunning setup.py clean for %szpython setup.py clean) command_desccwdTz Failed cleaning build dir for %sF) rrmr-r.r/rr0rterror)r(r` clean_argsr%r%r&ru1sru) requirementsrEr^r_r`r!c Cs|s ggfStdddd|Dtgg}}|D]}|jsLtt||}t||||||jol|j } | r|j dk r| ||j t t | |_|jj|_|jjst||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(r%r%r& Tszbuild..NzSuccessfully built %s cSsg|] }|jqSr%rrr%r%r& wszbuild..zFailed to build %scSsg|] }|jqSr%rrr%r%r&r|s)r-r.rprr/r;rJrhr1permit_editable_wheels download_inforecord_download_originrrr9 file_pathlocal_file_pathr,append) rrEr^r_r`build_successesbuild_failuresr(rF wheel_filer%r%r&buildBsL         r)M__doc__loggingos.pathrNrerqtypingrrrrrrpip._vendor.packaging.utilsrr Zpip._vendor.packaging.versionr r pip._internal.cacher pip._internal.exceptionsr rpip._internal.metadatarrpip._internal.models.linkrpip._internal.models.wheelr$pip._internal.operations.build.wheelr-pip._internal.operations.build.wheel_editabler+pip._internal.operations.build.wheel_legacyrZpip._internal.req.req_installrpip._internal.utils.loggingrpip._internal.utils.miscrrr$pip._internal.utils.setuptools_buildrpip._internal.utils.subprocessrpip._internal.utils.temp_dirrpip._internal.utils.urlsrpip._internal.vcsr getLogger__name__r-compile IGNORECASEr#r"BinaryAllowedPredicate BuildResultrRr'r4r7r8rDrJr6r\rhrerurr%r%r%r&s                 6   !  ' G