o bc @sddZddlmZddlmZmZddlZddlZddlZGdddeZ ddZ d d Z d d Z dS) zdistutils.command.install_egg_info Implements the Distutils 'install_egg_info' command, for installing a package's PKG-INFO metadata.)Command)logdir_utilNc@s<eZdZdZdZddgZddZddZd d Zd d Z d S)install_egg_infoz)Install an .egg-info file for the packagez8Install package's PKG-INFO metadata as an .egg-info file)z install-dir=dzdirectory to install to)zinstall-layoutNzcustom installation layoutcCsd|_d|_d|_dSN) install_dirinstall_layout prefix_optionselfr 9/usr/lib/python3.10/distutils/command/install_egg_info.pyinitialize_optionss z#install_egg_info.initialize_optionscCs|dd|dd|dd|jr(|jdvr td|jdk}n|jr.d }nd }|rGd tt|jtt |j f}nd tt|jtt |j gt j dd R}t j|j||_|jg|_dS)N install_lib)rrinstall)r r )r r )debunixz"unknown value for --install-layoutrFTz%s-%s.egg-infoz%s-%s-py%d.%d.egg-info)set_undefined_optionsr lowerDistutilsOptionErrorr to_filename safe_name distributionget_name safe_version get_versionsys version_infoospathjoinrtargetoutputs)r no_pyverbasenamer r rfinalize_optionss2    z!install_egg_info.finalize_optionscCs|j}tj|rtj|stj||jdn'tj|r+| tj |jfd|ntj|j s?| tj |j fd|j t d||jsit|ddd}|jj|WddS1sbwYdSdS)N)dry_runz Removing z Creating z Writing %swzUTF-8)encoding)r#r r!isdirislinkr remove_treer(existsexecuteunlinkrmakedirsrinfoopenrmetadatawrite_pkg_file)r r#fr r rrun4s  "zinstall_egg_info.runcCs|jSr)r$r r r r get_outputsBszinstall_egg_info.get_outputsN) __name__ __module__ __qualname____doc__ description user_optionsrr'r7r8r r r rr s rcCstdd|S)zConvert an arbitrary string to a standard distribution name Any runs of non-alphanumeric/. characters are replaced with a single '-'. [^A-Za-z0-9.]+-)resubnamer r rrJsrcCs|dd}tdd|S)zConvert an arbitrary string to a standard version string Spaces become dots, and all other non-alphanumeric characters become dashes, with runs of multiple dashes condensed to a single dash.  .r?r@)replacerArB)versionr r rrRs rcCs |ddS)z|Convert a project or version name to its filename-escaped form Any '-' characters are currently replaced with '_'. r@_)rGrCr r rr\s r) r< distutils.cmdr distutilsrrr rrArrrrr r r rs ?