a Re/@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-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/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_commandisr8cCs|js |jsdS|jrb|jjrb|jr(J|js2Jt|jj}|sHJ||jj|jr^dSdS|jslJ|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_vcsrget_backend_for_schemeschemeis_immutable_rev_checkouturlsplitextr')r( vcs_backendbaseextr%r%r& _should_cachers    rC)r( wheel_cacher!cCs>t|j}|jsJ|r.t|r.||j}n ||j}|S)zdReturn the persistent or temporary cache directory where the built wheel need to be stored. )r" cache_dirr9rCget_path_for_linkget_ephem_path_for_link)r(rDcache_availablerEr%r%r&_get_cache_dirs     rI)_r!cCsdS)NTr%)rJr%r%r&r6sr6)r( wheel_pathr!c Cst|jp d}ttj|}t|j|kr>td||jtt ||}t |j }t |t |j krztd||j |j }|durtdz t|}Wn$tyd|}t|Yn0|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(rKcanonical_namewdist dist_verstrmetadata_version_valuerSmsgr%r%r& _verify_ones<    r[)r( output_dirverify build_optionsglobal_optionsr1r!c Cs|rdnd}z t|Wn8tyP}z td||j|WYd}~dSd}~00|j t|||||}Wdn1s~0Y|r|rzt||Wn<tt fy}z td||j|WYd}~dSd}~00|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_r1artifacterKr%r%r& _build_ones,   "rg)r(r\r^r_r1r!c Cstddl}|jsJ|jr|js(J|js2J|rDtd|j|rVtd|j|rtt|j|j|j|jd}qt |j|j|j|jd}nt |j|j |j |||jd}|durVt j|}t j||}zPt|\} } t||td|j|| | td||WWdStyT} ztd |j| WYd} ~ n d} ~ 00|jsht||WddS1s0YdS) Nr`)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^rkz3Created wheel for %s: filename=%s size=%d sha256=%szStored in directory: %sz Building wheel for %s failed: %s)rr/r3rjpep517_backendr-rbrrNrrrlunpacked_source_directoryrMrOjoinrshutilmover. hexdigest Exception_clean_one_legacy) r(r\r^r_r1temp_dirrK wheel_name dest_path wheel_hashlengthrfr%r%r&rdst         rd)r(r_r!cCsXt|j|d}td|jzt||jdWdStyRtd|jYdS0dS)N)r_zRunning setup.py clean for %s)cwdTz Failed cleaning build dir for %sF) rrlr-r.r/rr0rserror)r(r_ clean_argsr%r%r&rt1s rt) requirementsrDr]r^r_r!c Cs|s ggfStdddd|Dtgg}}|D]p}|jsLJt||}t||||||jol|j} | rt t | |_ |j j |_ |j jsJ||q>||q>Wdn1s0Y|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& Rzbuild..NzSuccessfully built %s cSsg|] }|jqSr%r~rr%r%r& orzbuild..zFailed to build %scSsg|] }|jqSr%r~rr%r%r&rtr)r-r.rorr/rIrgr1permit_editable_wheelsrrr9 file_pathlocal_file_pathr,append) r}rDr]r^r_build_successesbuild_failuresr(rE wheel_filer%r%r&build@sH        *r)M__doc__loggingos.pathrMrerptypingrrrrrrpip._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 BuildResultrQr'r4r7r8rCrIr6r[rgrdrtrr%r%r%r&s                 6   !  ' G