File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/relenv/build/common/__pycache__/install.cpython-310.pyc
Back
o ;j�J � @ sj d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl Z ddl Z ddlZddlZddl Z ddlZddlmZmZ ddlZddlmZmZmZmZmZmZmZ erlddlmZmZ ddlm Z dd l!m"Z" e#ej$e# B Z$d Z%e�&e'�Z(dBdd�Z)dCdd�Z*dDdd�Z+dBdd�Z,dEdd�Z-dFd"d#�Z.dGd*d+�Z/dHd-d.�Z0dId0d1�Z1dJd8d9�Z2 dKdLd@dA�Z3dS )Mz@ Installation and finalization functions for the build process. � )�annotationsN)�IO� TYPE_CHECKING)�LINUX� MODULE_DIR�MissingDependencyError�Version�download_url�format_shebang�runcmd)�MutableMapping�Sequence)� ModuleType� )�DirsaB import os; import sys; from importlib import util; from pathlib import Path; spec = util.spec_from_file_location('relenv.runtime', str(Path(__file__).parent / 'site-packages' / 'relenv' / 'runtime.py')); mod = util.module_from_spec(spec); sys.modules['relenv.runtime'] = mod; spec.loader.exec_module(mod); mod.bootstrap();�path�PathLike�old�str�new�return�Nonec C sf t �d| � t�| �} | �� st �d| � dS | jdd�}tj|||tj tj B d�}| j|dd� dS )a Search a file for a string to replace. :param path: Location of the file to search :type path: str :param old: The value that will be replaced (regex) :type old: str :param new: The value that will replace the 'old' value. :type path: str zPatching file: %szFile not found for patching: %sN�utf-8��encoding)�flags)�log�debug�pathlib�Path�exists�warning� read_text�re�sub� IGNORECASE� MULTILINE� write_text)r r r �contentZnew_content� r) �O/opt/saltstack/salt/lib/python3.10/site-packages/relenv/build/common/install.py� patch_file<