%PDF- %PDF-
Direktori : /snap/core20/current/lib/python3/dist-packages/setuptools/__pycache__/ |
Current File : //snap/core20/current/lib/python3/dist-packages/setuptools/__pycache__/namespaces.cpython-38.pyc |
U @{?^� � @ sR d dl Z d dlmZ d dlZd dlmZ ejjZG dd� d�Z G dd� de �Z dS )� N)�log)�mapc @ sT e Zd ZdZdd� Zdd� Zdd� ZdZd Zd d� Z dd � Z dd� Zedd� �Z dS )� Installerz -nspkg.pthc C s� | � � }|sd S tj�| �� �\}}|| j7 }| j�|� t� d|� t | j|�}| jrdt |� d S t|d��}|�|� W 5 Q R X d S )Nz Installing %sZwt)�_get_all_ns_packages�os�path�splitext�_get_target� nspkg_extZoutputs�appendr �infor �_gen_nspkg_lineZdry_run�list�open� writelines)�selfZnsp�filename�ext�lines�f� r �7/usr/lib/python3/dist-packages/setuptools/namespaces.py�install_namespaces s zInstaller.install_namespacesc C sH t j�| �� �\}}|| j7 }t j�|�s.d S t�d|� t �|� d S )NzRemoving %s) r r r r r �existsr r �remove)r r r r r r �uninstall_namespaces! s zInstaller.uninstall_namespacesc C s | j S �N)�target�r r r r r ) s zInstaller._get_target) zimport sys, types, osz#has_mfs = sys.version_info > (3, 5)z$p = os.path.join(%(root)s, *%(pth)r)z4importlib = has_mfs and __import__('importlib.util')z-has_mfs and __import__('importlib.machinery')z�m = has_mfs and sys.modules.setdefault(%(pkg)r, importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec(%(pkg)r, [os.path.dirname(p)])))zCm = m or sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))z7mp = (m or []) and m.__dict__.setdefault('__path__',[])z(p not in mp) and mp.append(p))z4m and setattr(sys.modules[%(parent)r], %(child)r, m)c C s dS )Nz$sys._getframe(1).f_locals['sitedir']r r r r r � _get_rootG s zInstaller._get_rootc C sV t |�}t|�d��}| �� }| j}|�d�\}}}|rB|| j7 }d�|�t� d S )N�.�;� ) �str�tuple�splitr �_nspkg_tmpl� rpartition�_nspkg_tmpl_multi�join�locals)r �pkgZpth�rootZ tmpl_lines�parent�sepZchildr r r r J s zInstaller._gen_nspkg_linec C s | j jp g }ttt| j|���S )z,Return sorted list of all package namespaces)ZdistributionZnamespace_packages�sorted�flattenr � _pkg_names)r Zpkgsr r r r U s zInstaller._get_all_ns_packagesc c s( | � d�}|r$d�|�V |�� q dS )z� Given a namespace package, yield the components of that package. >>> names = Installer._pkg_names('a.b.c') >>> set(names) == set(['a', 'a.b', 'a.b.c']) True r N)r% r) �pop)r+ �partsr r r r1 Z s zInstaller._pkg_namesN)�__name__� __module__�__qualname__r r r r r&