
    iYf\                     ~   d Z 	 ddlZn# e$ r Y nw xY wddlZddlm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mZ ddlmZ ddlZddlmZ ddlmZ 	 ddlZn# e$ r ddlZY nw xY wddlmZ ddlZ ej        d	          Zd
ZdZdZdZdZ d Z!d Z"ddZ#ddZ$d Z%d Z&d Z'd Z(d Z)d Z* G d de          Z+dS )a  The code in this module is mostly copy/pasted out of the distutils2 source
code, as recommended by Tarek Ziade.  As such, it may be subject to some change
as distutils2 development continues, and will have to be kept up to date.

I didn't want to use it directly from distutils2 itself, since I do not want it
to be an installation dependency for our packages yet--it is still too unstable
(the latest version on PyPI doesn't even install).
    N)defaultdict)errors)log)dist)	extension)extra_filesz\s*(.*?)\s*\((.*)\)\s*$)#))metadatanamer
   ))r	   versionr   ))r	   authorr   ))r	   author_emailr   ))r	   
maintainerr   ))r	   maintainer_emailr   ))r	   	home_pageurl))r	   project_urlsr   ))r	   summarydescription))r	   keywordsr   ))r	   r   long_description))r	   description_content_typelong_description_content_type))r	   download_urlr   ))r	   
classifierclassifiers))r	   platform	platforms))r	   licenser   ))r	   requires_distinstall_requires))r	   setup_requires_distsetup_requires))r	   python_requiresr#   ))r	   requires_pythonr#   ))r	   provides_distprovides))r	   provides_extrasr'   ))r	   obsoletes_dist	obsoletes))filespackages_rootpackage_dir))r*   packagesr-   ))r*   package_datar.   ))r*   namespace_packagesr/   ))r*   
data_filesr0   ))r*   scriptsr1   ))r*   modules
py_modules))globalcommandscmdclass))backwards_compatzip_safer8   ))r7   tests_requirer9   ))r7   dependency_linksr:   ))r7   include_package_datar;   )r   r   r    r&   r)   r/   r-   r.   r0   r1   r3   r:   r"   r9   r   r6   r'   )r   )r8   r;    c                     t           j        dk    r4|                     dd          } d t          j        |           D             S t          j        |           S )Nnt\/c                 :    g | ]}|                     d d          S )r@   r?   )replace).0xs     C:\Users\Admin\Desktop\cercetare\experiment de trasmitere a informatiei din viitor in prezent\qiskit_env\Lib\site-packages\pbr/util.py
<listcomp>zshlex_split.<locals>.<listcomp>   s&    @@@		#t$$@@@    )osr
   rB   shlexsplit)paths    rE   shlex_splitrL      sP    	w$ ||D#&&@@ek$.?.?@@@@;trG   c                    |                      d          }t          |          dz
  }|d|         }|d         }|dk    r]	 t          d                    |          |g          }n6# t          $ r# |dk    r |dz  }|d|         }||         }d}Y nw xY w|dk    ]||d         D ]0}	 t          ||          }# t          $ r t	          |           w xY w|S )zResolve a name like ``module.object`` to an object and return it.

    Raise ImportError if the module or name is not found.
    .   Nr   )fromlist )rJ   len
__import__joinImportErrorgetattrAttributeError)r
   partscursormodule_name	attr_nameretparts          rE   resolve_namer_      s"    JJsOOEZZ!^F.Kb	I
1**		SXXk22i[IIIC 	 	 	{{aKF.KfICCC		 1** fgg $ $	$#t$$CC 	$ 	$ 	$d###	$ Js   %A' '*BB*B;;C	setup.cfgc           	         t           j        dk    rt          j                    }nt          j                    }t
          j                            |           s4t          j	        dt
          j        
                    |           z            	 |                    | d           n%# t          $ r |                    |            Y nw xY wi }|                                D ]M}t                      ||<   |                    |          D ]$\  }}|||         |                    dd          <   %Nt#          |dd          }t#          |d	d
          }|r?t
          j        
                    |          }t           j                            d|           	 |rd t'          |          D             }|D ]}	t)          |	          }
	  |
|           # t*          $ r t-          j        d           Y >t0          $ rp t          j                    d         }t-          j        d|	d|d           t-          j        t5          j                               t          j        d           Y w xY wt:          j                            |           tA          ||          }d|d<   d|d<   tC          |           tE          |          }|r||d<   tG          |          }|r||d<   t#          |d	d          }|r!tI          j%        t'          |                     |rt           j        &                    d           n'# |r t           j        &                    d           w w xY w|S )a  Distutils2 to distutils1 compatibility util.

    This method uses an existing setup.cfg to generate a dictionary of
    keywords that can be used by distutils.core.setup(kwargs**).

    :param path:
        The setup.cfg path.
    :param script_args:
        List of commands setup.py was called with.
    :raises DistutilsFileError:
        When the setup.cfg file is not found.
    )   r   zfile '%s' does not existutf-8encoding-_r4   setup_hooksr*   r+   r   c                     g | ]
}|d k    |S )zpbr.hooks.setup_hookr<   )rC   hooks     rE   rF   zcfg_to_args.<locals>.<listcomp>   s.     3 3 3111 111rG   z)setup hook %s terminated the installationrO   zsetup hook z raised exception: 
Tr;   Fr8   ext_modulesentry_pointsr   )'sysversion_infoconfigparserConfigParserSafeConfigParserrH   rK   existsr   DistutilsFileErrorabspathread	TypeErrorsectionsdictitemsrB   has_get_optioninsertsplit_multiliner_   
SystemExitr   error	Exceptionexc_info	traceback
format_excexitpbrhooks
setup_hooksetup_cfg_to_setup_kwargsregister_custom_compilersget_extension_modulesget_entry_pointsr   set_extra_filespop)rK   script_argsparserconfigsectionkvaluerh   r,   rj   hook_fnekwargsrl   rm   files_extra_filess                   rE   cfg_to_argsr      s    6!!*,,.007>>$ ?'(B(*(=(=)> ? ? 	?D7++++   D F??$$ 9 9&&wW-- 	9 	9HAu38F7OAIIc3//00	9 !=AAK /BBK
  (gook22;'''- 	 3 3!0!=!=3 3 3K $    &t,,	 GFOOOO! K K KIIJJJJJ       q)AII#ttQQQ( ) ) )Ii244555HQKKKKK  		V$$$*6;?? *.%&"z!&)))+F33 	0$/F=!'// 	2%1F>" +67MJJ 	L'8I(J(JKKK  	HLLOOO  	HLLOOOO	 MsP   B$ $CC.L2  GL2 I%*L2 ,A6I%"L2 $I%%B+L2 2$Mc                 
   i }i }t           D ]\  }}|\  }}t          | ||          }|s|dk    rt          | |d          }|rt          |          }d}	|D ]r}
t          j        |
d          }	 |	|                                                                dz   z  }	|                                 Z# |                                 w xY w|	}|s|t          v rt          |          }|t          v rt          |          }n|t          v rYi }t          |          D ]D}|                    dd          \  }}|                                ||                                <   E|}n$|t          v r|                                d	v rd
}nd}|r:|dv rd |D             }|dk    rg }d}|D ]|}t          j        ||          }|                    d                                          }|                    d                                          }|                    ||f           }||d<   n|dk    rd|i}n|dv r6i }d
}d}|D ]}d|v r|                    dd          \  }}	t'          |                                          d         }||	                                }	}||v r+||         }|                    t'          |	                     ntt'          |	          x}||                                <   nM|rt+          j        d|z            |                    t'          |                                                     d}|dk    r!t/          |                                          }|}nS|dk    rMi }t3          j                    }|D ]3}t7          |          } ||          } |||                                 <   4|}|||<   d| v rd}| d         }!d|!vrJddlm}" d                    |"                     |"j!                            "                    dd          |!d<   |!D ]}#g }$t          |!|#                   }%|%D ]j}t          j        ||          }|                    d                                          }&|                    d          }|$                    |&|f           k|$||#<   i }'|D ]}(||(         D ]}\  }}|rK|(d |d!})d"|vr>	 tG          j$        d#|z            r|(})n&# tJ          $ r tM          j'        d$            w xY wn|(})|'(                    |)g                               |           ~|')                    dg           |d<   |'|d%<   |S )&zConvert config options to kwargs.

    Processes the setup.cfg options and converts them to arguments accepted
    by setuptools' setup() function.
    r   description_filerR   rc   rd   z

=rO   )truet1yesyTF)r    r9   c                 D    g | ]}t                               d |          S )z\1\2)_VERSION_SPEC_REsub)rC   preds     rE   rF   z-setup_cfg_to_setup_kwargs.<locals>.<listcomp>e  s8      :  :  :$( !1 4 4Wd C C  :  :  :rG   r    z6(?P<package>[^;]*);?(?P<env_marker>[^#]*?)(?:\s*#.*)?$package
env_markerr,   )r.   r0   Nr   z1malformed package_data first line %r (misses "=")r0   r6   extrasz6(?P<package>[^:]*):?(?P<env_marker>[^#]*?)(?:\s*#.*)?$test)	packagingrk   ;:z:()bdist_wheelz(%s)zMarker evaluation failed, see the following error.  For more information see: http://docs.openstack.org/pbr/latest/user/using.html#environment-markersextras_require)*CFG_TO_PY_SETUP_ARGSr{   r}   ioopenrv   stripclose
CSV_FIELDS	split_csvMULTI_FIELDS
MAP_FIELDSrJ   BOOL_FIELDSlowerrematchgroupappendrL   extendr   DistutilsOptionErrorsortedrz   st_distDistributionr_   get_command_namer   r   rU   parse_requirementsTEST_REQUIREMENTS_FILESrB   pkg_resourcesevaluate_markerSyntaxErrorr   r   
setdefaultr   )*r   r   r   all_requirementsaliasargr   optionin_cfg_valuer   filenamer   
in_cfg_mapir   vr    requirement_patternrequirementmrequirement_packager   r0   	firstlineprevlinekeykey_unquotedr6   r   cls_nameclscmdr   r   extraextra_requirementsrequirementsextras_valuer   	req_group
extras_keys*                                             rE   r   r   /  s    F * _# _#
s%fgv>> 	%'9 9 9)&';MNNL 	%.|<< , 1 1H')wx''J'J'J$1!1!6!6!8!8!>!>!@!@6!II(..0000(..0000$ 	*$\22L,*<88LLJJ$\22 2 2wwsA1()		
17799%%%LLK!!##'EEE#$ 8	(;;; :  :,8 :  :  :((( $& M $#/ O OK!4kBBA*+'')*<*<*B*B*D*D'!"!6!6!<!<!>!>J$++-@*,MNNNN'7 $$%% "L1666
 	( & &Dd{{%)ZZQ%7%7
U'2399;;'?'?'B&2EKKMMU*,, $.c?D KKE(:(:;;;;=H=O=OOD:ciikk#:#:" ?$9#%)*+ + + K

$=$=>>> %II,&& "(
(8(8(:(:!;!;J)
""+-- , ; ;H&x00C#d))C7:HS113344'"s 6E 	! %%%%%%!YYy'C'C1(3 (3 4 44;GC4E4E 6N  	9 	9E!#*6%=99L+ F FH0+>> wwy117799WW\22
"))<*DEEEE&8U## N% J J	'7	'B 	J 	J#K '*3))ZZZ@

 !33
(8*9LMM 3)2J&   	M   	 4 '
%%j"55<<[IIII+	J. "0!3!3B!;!;F-FMs   /,B00CS// Tc                 |   t          | dd          }|rt          |          }|D ]}t          |          }t          |d          r|j        }n|j        }t          |d          r|j        }nd|z  }|j        }t          j	        j
        }||j        |f||<   t          j        |         t          j        d|z   <   dS dS )zHandle custom compilers.

    This has no real equivalent in distutils, where additional compilers could
    only be added programmatically, so we have to hack it in somehow.
    r4   	compilersr
   r   zcustom compiler %sz
distutils.N)r{   r}   r_   hasattrr
   __name__r   
__module__	distutils	ccompilercompiler_classrn   r2   )r   r   compilerr
   descr[   ccs          rE   r   r     s     vx==I O#I..	! 	O 	OH#H--H x(( )}(x// 3++d2"-K $3B#X%6=BtH 7:k+6NCK{2331O O	O 	OrG   c                    d}g }| D ]w}d|v r|                     dd          }n|                     dd          }d |D             }t          |          dk    r#|d         dk    ri }|D ]}t          | ||          }|st          |          }|d	k    rg }|D ]}	|	                     dd          }	t          |	          dk    r|	d                                         d
f}	n4|	d                                         |	d                                         f}	|                    |	           |}|||<   |rGd|vr|d         |d<   |                    t          j        |                    d          fi |           y|S )zHandle extension modules)sourcesinclude_dirsdefine_macrosundef_macroslibrary_dirs	librariesruntime_library_dirsextra_objectsextra_compile_argsextra_link_argsexport_symbols	swig_optsdependsr   rO   r   c                 6    g | ]}|                                 S r<   r   )rC   labels     rE   rF   z)get_extension_modules.<locals>.<listcomp>  s     444E%++--444rG      r   r   r   Nr
   )	rJ   rS   r{   r}   r   r   r   	Extensionr   )
r   EXTENSION_FIELDSrl   r   labelsext_argsfieldr   macrosmacros
             rE   r   r     s   # K D D'>>]]3**FF ]]3**F44V444KK16!9#;#;H) ( (&vw>>  '..O++F!& - - %C 3 3u::??%*1X^^%5%5t$<EE%*1X^^%5%5uQx~~7G7G$HEe,,,,"E"' D))'-ayHV$""9#6x||F7K7K $C $C9A$C $C D D DrG   c                 p    d| vri S t          d | d                                         D                       S )a  Process the [entry_points] section of setup.cfg.

    Processes setup.cfg to handle setuptools entry points. This is, of course,
    not a standard feature of distutils2/packaging, but as there is not
    currently a standard alternative in packaging, we provide support for them.
    rm   c              3   >   K   | ]\  }}|t          |          fV  d S N)r}   )rC   r   r   s      rE   	<genexpr>z#get_entry_points.<locals>.<genexpr>G  sO       E E!FE //0 E E E E E ErG   )ry   rz   )r   s    rE   r   r   <  s[     V##	 E E%+N%;%A%A%C%CE E E E E ErG   c                 >    || v r|| |         v r| |         |         S dS )NFr<   )r   r   r   s      rE   r{   r{   K  s/    &Vvg66gv&&urG   c                 X    d d |                      d          D             D             } | S )z3Special behaviour when we have a multi line optionsc                 @    g | ]}||                     d           |S )#)
startswithrC   elements     rE   rF   z#split_multiline.<locals>.<listcomp>U  sB     9 9 99 ' 2 23 7 79W 9 9 9rG   c              3   >   K   | ]}|                                 V  d S r  r   )rC   r   s     rE   r  z"split_multiline.<locals>.<genexpr>V  s*      99tdjjll999999rG   rk   rJ   r   s    rE   r}   r}   R  sA    9 999u{{4'8'89999 9 9E LrG   c                 X    d d |                      d          D             D             } | S )z8Special behaviour when we have a comma separated optionsc                     g | ]}||S r<   r<   r  s     rE   rF   zsplit_csv.<locals>.<listcomp>^  s,       W   rG   c              3   >   K   | ]}|                                 V  d S r  r   )rC   chunks     rE   r  zsplit_csv.<locals>.<genexpr>_  s*      ::ekkmm::::::rG   ,r  r  s    rE   r   r   [  sA     ::S)9)9:::  E LrG   c                   $     e Zd ZdZd fd	Z xZS )DefaultGetDictzDLike defaultdict, but get() also sets and returns the default value.Nc                     ||                                  }t          t          |                               ||          S r  )default_factorysuperr  r   )selfr   default	__class__s      rE   getzDefaultGetDict.geth  s9    ?**,,G^T**55c7CCCrG   r  )r   r   __qualname____doc__r$  __classcell__)r#  s   @rE   r  r  e  sM        NND D D D D D D D D DrG   r  )r`   r<   )r<   ),r&  multiprocessingrV   loggingcollectionsr   r   rH   r   rI   rn   r   distutils.ccompilerr   r   r   r   
setuptoolsr   r   r   rq   rp   r   r   	pbr.hookscompiler   r   r   r   r   r   rL   r_   r   r   r   r   r   r{   r}   r   r  r<   rG   rE   <module>r/     s  \ 	 	 	 	D	  # # # # # # 				 				 				  



                         & & & & & &            '''''              2:899 + \#& 
 3
    @\ \ \ \~r r r rj O  O  OF2 2 2jE E E      D D D D D[ D D D D Ds   	 A 	A('A(