MINI MINI MANI MO
3
  \5Q                 @   s  d Z ddlZddlZddlZddlZddlZddlmZ ddl	m
Z
 ddlmZ ddl
mZ ddlmZ dd	 Zd
d Zdd
 Zdadd Zdd Zd(ddZd a aadd Zdd Zd)ddZdd Zd*ddZd d! Zd+d"d#Z d,d$d%Z!G d&d' d'Z"dS )-zudistutils.util
Miscellaneous utility functions -- anything that doesn't fit into
one of the other *util.py modules.
    N)DistutilsPlatformError)newer)spawn)log)DistutilsByteCompileErrorc              C   s  t jdkrnd} tjj| }|d)kr(tjS tjjd|}tj|t|  | j }|dkr\dS |dkrhdS tjS d	t jkrt jd	 S t jd
kst	t d rtjS t j
 \}}}}}|j jdd
}|jdd}|jdd}|dd dkrd||f S |dd dkrV|d dkrd}dt|d d |dd f }ddd}	|d|	tj
  7 }n|dd  d!krtd||f S |dd d"krd#|||f S |dd$ d%krd%}tjd&tj}
|
j|}|r|j }n>|dd$ d'krddl}ddl}
|j|
jj |||\}}}d(|||f S )*a  Return a string that identifies the current platform.  This is used
    mainly to distinguish platform-specific build directories and
    platform-specific built distributions.  Typically includes the OS name
    and version and the architecture (as supplied by 'os.uname()'),
    although the exact information included depends on the OS; eg. for IRIX
    the architecture isn't particularly important (IRIX only runs on SGI
    hardware), but for Linux the kernel version isn't particularly
    important.
    Examples of returned values:
       linux-i586
       linux-alpha (?)
       solaris-2.6-sun4u
       irix-5.3
       irix64-6.2
    Windows will return one of:
       win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)
       win-ia64 (64bit Windows on Itanium)
       win32 (all others - specifically, sys.platform is returned)
    For other non-POSIX platforms, currently just returns 'sys.platform'.
    ntz bit (   )amd64z	win-amd64itaniumzwin-ia64_PYTHON_HOST_PLATFORMposixuname/  _-N   linuxz%s-%ssunosr   5solarisz%d.%s      32bit64bit)il    z.%s   irixaixz%s-%s.%s   cygwinz[\d.]+darwinz%s-%s-%s)osnamesysversionfindplatformlenlowerenvironhasattrr   replaceintmaxsizerecompileASCIImatchgroup_osx_supportZdistutils.sysconfigget_platform_osx	sysconfigget_config_vars)prefixijlookosnamehostreleaser'   machinebitnessrel_remr6   	distutils rF   &/usr/lib64/python3.6/distutils/util.pyget_platform   sX    
 
rH   c             C   s~   t jdkr| S | s| S | d dkr.td|  | d dkrFtd|  | jd}xd|krf|jd qRW |srt jS t jj| S )a  Return 'pathname' as a name that will work on the native filesystem,
    i.e. split it on '/' and put it back together again using the current
    directory separator.  Needed because filenames in the setup script are
    always supplied in Unix style, and have to be converted to the local
    convention before we can actually use them in the filesystem.  Raises
    ValueError on non-Unix-ish systems if 'pathname' either starts or
    ends with a slash.
    r   r   zpath '%s' cannot be absoluter   zpath '%s' cannot end with '/'.r#   )r$   sep
ValueErrorsplitremovecurdirpathjoin)pathnamepathsrF   rF   rG   convert_patho   s    	
rS   c             C   s   t jdkr<t jj|s$t jj| |S t jj| |dd S nNt jdkr|t jj|\}}|d dkrn|dd }t jj| |S tdt j dS )a	  Return 'pathname' with 'new_root' prepended.  If 'pathname' is
    relative, this is equivalent to "os.path.join(new_root,pathname)".
    Otherwise, it requires making 'pathname' relative and then joining the
    two, which is tricky on DOS/Windows and Mac OS.
    r
   r   Nr   r   \z!nothing known about platform '%s')r$   r%   rO   isabsrP   
splitdriver   )Znew_rootrQ   ZdriverO   rF   rF   rG   change_root   s    
rW   c              C   sZ   t rdS tjdkr<dtjkr<ddl} | jtj d tjd<