�
���cX � �t � d dl Z d dlZd dlZd dlZd dlZd dlZd dlZej d� � � Zej ddefd�� � Z d� Z
ej ej fd�� � Zej ddefd�� � Z
ej d� � � Z G d � d
� � Z G d� dej ej � � Z G d
� dej � � ZdS )� Nc # � K � t j � � }t j | � � | V � t j |� � d S # t j |� � w xY w�N)�os�getcwd�chdir)�dir�origs �C/usr/lib/python3/dist-packages/setuptools/_vendor/jaraco/context.py�pushdr
sO � � � �
�9�;�;�D��H�S�M�M�M��� � � �
������������������s �A �Ac
# � K � |�Gt j � | � � � dd� � � dd� � }|� t j t j d�� � } | dj d
i t � � ��� � d}d }d
�
||f� � } | |j d
dt | � � it � � ��� � ||� � 5 |V � ddd� � n# 1 swxY w Y | dj d
i t � � ��� � dS # | dj d
i t � � ��� � w xY w)z�
Get a tarball, extract it, change to that directory, yield, then
clean up.
`runner` is the function to invoke commands.
`pushd` is a context manager for changing the directory.
Nz.tar.gz� z.tgzT)�shellzmkdir {target_dir}zwget {url} -O -z7tar x{compression} --strip-components=1 -C {target_dir}z | �compressionzrm -Rf {target_dir}� )r �path�basename�replace� functools�partial�
subprocess�
check_call�format�vars�join�infer_compression)�url�
target_dir�runnerr �getter�extract�cmds r
�tarball_contextr" |