HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/ppbt/__pycache__/common.cpython-310.pyc
o

�N�g��@s�dZddlZddlZddlZddlZddlZddlZdZe�e	�Z
Gdd�de�Zddd�Z
dd	�Ze
e��Ze�e�jd
e�d�Ze�e�jd
ZeeZe�e���jjde�d
�Zdd�Zddd�Zddd�ZdS)z
Toolchain build environment.
�Nz0.1.8c@seZdZdZdS)�
PPBTExceptionz.
    Base class for all ppbt exceptions.

    N)�__name__�
__module__�__qualname__�__doc__�rr�?/opt/saltstack/salt/lib/python3.10/site-packages/ppbt/common.pyrsrcCsX|stj}|s
t�}|dkr|�d�S|dkr|�d�S|dkr%|�d�Std|����)a�
    Get the target triplet for the specified machine and platform.

    If any of the args are None, it will try to deduce what they should be.

    :param machine: The machine for the triplet
    :type machine: str
    :param plat: The platform for the triplet
    :type plat: str

    :raises BuildError: If the platform is unknown

    :return: The target triplet
    :rtype: str
    �darwinz-macos�win32z-win�linuxz
-linux-gnuzUnknown platform )�sys�platform�
build_archr)�machine�platrrr�get_triplets


rcCst��}|��S)z%
    Return the current machine.
    )r
r�lower)rrrrr9srZ
_toolchainz.tar.xzzppbt-z
.dist-infocCsp|�d�rd}n|�d�rd}n
|�d�rd}nd}t�||��}|�|�Wd�dS1s1wYdS)	z�
    Extract an archive to a specific location.

    :param to_dir: The directory to extract to
    :type to_dir: str
    :param archive: The archive to extract
    :type archive: str
    �tgzzr:gz�xzzr:xz�bz2zr:bz2�rN)�endswith�tarfile�open�
extractall)�to_dir�archive�	read_type�trrr�extract_archiveLs
	

"�rFcCsBt��r
|s
t�d�dSt�d�tttt��t	d}|��r�g}t�d�t
|d��}t�|�D]}|�
|�q3Wd�n1sEwYt
tt�dd��}t�|�D]}|�
|�qYWd�n1skwYt|dd	�d
�}t
|d��}t�|�}|D]}|�|�q�Wd�dS1s�wYdSdS)z(
    Extract the toolchain tarball.
    zToolchain directory existszExtract archive�RECORDzUpdate pkg metadatarNz.recordcSs|dS)Nrr)�_rrr�<lambda>tszextract.<locals>.<lambda>)�key�w)�	TOOLCHAIN�exists�log�debug�infor�TOOLCHAIN_ROOT�str�ARCHIVE�DISTINFOr�csv�reader�append�sorted�writerZwriterow)Z	overwrite�record�records�fp�rowr2rrr�extractas4

����
�"��r7cCs�t��s|r
t�ntd��tdt}t�|�d�|�d�dt�dt�d�dt�dt�d�dt�dt�d�dt�dt�d	�d
�S)z&
    Toolchain build environment.
    zToolchain not extracted�binz-gccz-g++z-I�/z/sysroot/usr/includez-Lz/sysroot/lib)ZTOOLCHAIN_PATH�CC�CXX�CFLAGS�CPPFLAGSZCMAKE_FLAGS�LDFLAGS)r%r&r7�RuntimeError�TRIPLET)Zauto_extractZbasebinrrr�environ{s�rA)NN)F)rr.�logging�pathlibr
rr�__version__�	getLoggerrr'�	Exceptionrrrr@�Path�__file__�parentr,r*r%�resolver-rr7rArrrr�<module>s*


�