File: //lib64/python3.8/distutils/__pycache__/util.cpython-38.opt-1.pyc
U
e5dQ @ s d Z ddlZddlZddlZddlZddlZddlmZ ddl m
Z
ddlmZ ddl
mZ ddlmZ dd Zd
d Zdd
Zdd Zdadd Zdd Zd*ddZd a aadd Zdd Zd+ddZdd Zd,d d!Zd"d# Z d-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 jdkrFdtj krdS dtj kr.dS dtj kr@dS tjS dt jkrZt jd S t jd ksntt d
sttjS t \} }}}}| dd} | d
d}| dd}| dd dkrd| |f S | dd dkr,|d dkrd} dt
|d d |dd f }ddd}|d|tj 7 }n| dd dkrLd | ||f S | dd! d"krd"} t
d#tj}||}|r| }n>| dd! d$krddl}ddl} || j | ||\} }}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. on Linux, the kernel version isn't
particularly important.
Examples of returned values:
linux-i586
linux-alpha (?)
solaris-2.6-sun4u
Windows will return one of:
win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)
win32 (all others - specifically, sys.platform is returned)
For other non-POSIX platforms, currently just returns 'sys.platform'.
ntZamd64 win-amd64z(arm) win-arm32z(arm64)z win-arm64Z_PYTHON_HOST_PLATFORMposixuname/ _-N Zlinuxz%s-%sZsunosr 5Zsolarisz%d.%s Z32bitZ64bit)il z.%sZaixz%s-%s.%s cygwinz[\d.]+darwinz%s-%s-%s)osnamesysversionlowerplatformenvironhasattrr replaceintmaxsizerecompileASCIImatchgroup_osx_supportZdistutils.sysconfigZget_platform_osxZ sysconfigZget_config_vars)
ZosnameZhostreleaser machineZbitnessZrel_remr( distutils r- &/usr/lib64/python3.8/distutils/util.pyget_host_platform sR
r/ c C s8 t jdkr.dddd} | t jdp,t S t S d S )Nr Zwin32r r )Zx86Zx64ZarmZVSCMD_ARG_TGT_ARCH)r r getr r/ )ZTARGET_TO_PLATr- r- r. get_platforma s
r1 c C sz t jdkr| S | s| S | d dkr.td| | d dkrFtd| | d}d|krd|d qP|snt 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 absolutezpath '%s' cannot end with '/'.)r sep
ValueErrorsplitremovecurdirpathjoin)pathnamepathsr- r- r. convert_pathl s
r= c C s t jdkr<t j|s$t j| |S t j| |dd S nNt jdkr|t j|\}}|d dkrn|dd }t j| |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
Nr r \z!nothing known about platform '%s')r r r9 isabsr:
splitdriver )Znew_rootr; Zdriver9 r- r- r. change_root s
rB c C sx t rdS tjdkrZdtjkrZz$ddl} | t d tjd<