ó 3Y~gc @ sÇ d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d S( iÿÿÿÿNc C s¯ t j d d ƒ } | j d d d ƒ| j d d d d d d d t j j ƒ| j ƒ } d } y t t | ƒ GHWn' t k r } d j | ƒ GHd } n Xt j d ƒ d S( Nt descriptions, Recreate wheel of package with given RECORD.t record_patht helps Path to RECORD files -os --output-dirs> Dir where to place the wheel, defaults to current working dir.t destt outdirt defaulti s Failed: {}i ( t argparset ArgumentParsert add_argumentt ost patht curdirt parse_argst rewheel_from_recordt varst BaseExceptiont formatt syst exit( t parsert nst retcodet e( ( s? /opt/alt/python27/lib64/python2.7/ensurepip/rewheel/__init__.pyt run s c C s3 y t j SWn! t k r. t t d t j ƒ SXd S( sk Get prefix to site-specific directory prefix where the platform independent Python files are installed.t real_prefixN( R t base_prefixt AttributeErrort getattrt prefix( ( ( s? /opt/alt/python27/lib64/python2.7/ensurepip/rewheel/__init__.pyt _get_base_prefix s c C s' y t j SWn t k r" t j SXd S( sF Get exec_prefix dir used to find the machine-specific Python library.N( R t base_exec_prefixR t exec_prefix( ( ( s? /opt/alt/python27/lib64/python2.7/ensurepip/rewheel/__init__.pyt _get_base_exec_prefix) s c C sr g } t j d d k r( t j ƒ } n t j t ƒ t ƒ g ƒ } g | D] } t j j | ƒ rJ | ^ qJ } xý | D]õ } d } x® | D]¦ } t j j | | ƒ d j t j ƒ } g t j | ƒ D] } t j j | | ƒ ^ qà } g | D] } t j | | ƒ rë | ^ që } t | ƒ d k rˆ | d } qˆ qˆ W| d k r]| j t j j | d ƒ ƒ qu | j d ƒ qu W| S( s± Return list of paths to RECORD files for system-installed projects. If a project is not installed, the resulting list contains None instead of a path to its RECORD i i s -[^\{0}]+\.dist-infoi t RECORDN( R t version_infot sitet getsitepackagesR R R R t existst Nonet joinR t sept listdirt ret matcht lent append( t projectst recordst sys_sitepackt spt projectR t dist_info_ret pt candidatest ct filtered( ( s? /opt/alt/python27/lib64/python2.7/ensurepip/rewheel/__init__.pyt find_system_records0 s" + %1+c C s? t j j t j j | ƒ ƒ } | t | ƒ j t j j ƒ } t | | ƒ \ } } t | ƒ } t j j | | d ƒ } t j | d d d t j ƒ} t j ƒ } t j | ƒ } xO | D]G \ } } } | j t j j | | ƒ d | ƒ| j | | | g ƒ q· W| j | d d g ƒ | j | | j ƒ ƒ | j ƒ | j S( sc Recreates a whee of package with given record_path and returns path to the newly created wheel.s .whlt modet wt compressiont arcnamet ( R R t dirnameR, t stripR( t get_records_to_packt get_wheel_nameR' t zipfilet ZipFilet ZIP_DEFLATEDt iot BytesIOt csvt writert writet writerowt writestrt getvaluet closet filename( R R t site_dirt record_relpatht to_writet to_omitt new_wheel_namet new_wheel_patht new_wheelt new_recordRH t ft sha_hasht size( ( s? /opt/alt/python27/lib64/python2.7/ensurepip/rewheel/__init__.pyR N s " c C s€ t j j t j j | ƒ d ƒ } t j | d d ƒ% } t j j ƒ j | j ƒ ƒ } Wd QXt j j t j j | ƒ d ƒ } t j | d d ƒ% } t j j ƒ j | j ƒ ƒ } Wd QX| j d ƒ } | j d ƒ } d } g } x1 | j d ƒ D] } | j | j d ƒ d ƒ qô Wd j | ƒ } | j d ƒ j d ƒ d d !\ } } t d | | | | | | g ƒ } d j t | ƒ ƒ S( s. Return proper name of the wheel, without .whl.t WHEELt encodings utf-8Nt METADATAt Namet VersionR= t Tagt -i t .i i ( R R R' R> t codecst opent emailR t Parsert parsestrt readt gett get_allR- t splitt filterR&