Your IP : 13.59.217.1
3
9��f� � @ s� d Z ddlmZ ddlmZ ddlmZ ddlZddlZddl Z ddl
Z
ddlZddlZddl
Z
ddlmZ ddlmZmZ ddlmZ d d
lmZ dd� ZG d
d� de�ZdS )zpupload_docs
Implements a Distutils 'upload_docs' subcommand (upload documentation to
PyPI's pythonhosted.org).
� )�standard_b64encode)�log)�DistutilsOptionErrorN)�six)�http_client�urllib)�iter_entry_points� )�uploadc C s t jr
dnd}| jd|�S )N�surrogateescape�strictzutf-8)r �PY3�encode)�s�errors� r �!/usr/lib/python3.6/upload_docs.py�_encode s r c @ s� e Zd ZdZdZdddej fddgZejZdd� Zd
efgZ dd� Z
dd� Zdd� Zdd� Z
edd� �Zedd� �Zdd� ZdS )�upload_docszhttps://pypi.python.org/pypi/zUpload documentation to PyPIzrepository=�rzurl of repository [default: %s]�
show-responseN�&display full response text from server�upload-dir=�directory to uploadc C s$ | j d kr xtdd�D ]}dS W d S )Nzdistutils.commands�build_sphinxT)�
upload_dirr )�selfZepr r r �
has_sphinx/ s
zupload_docs.has_sphinxr c C s t j| � d | _d | _d S )N)r
�initialize_optionsr �
target_dir)r r r r r 6 s
zupload_docs.initialize_optionsc C s� t j| � | jd krN| j� r0| jd�}|j| _q`| jd�}tjj |j
d�| _n| jd� | j| _d| jkrtt
jd� | jd| j � d S )Nr �buildZdocsr zpypi.python.orgz3Upload_docs command is deprecated. Use RTD instead.zUsing upload directory %s)r
�finalize_optionsr r Zget_finalized_commandZbuilder_target_dirr �os�path�joinZ
build_baseZensure_dirname�
repositoryr �warn�announce)r r r r r r r! ; s
zupload_docs.finalize_optionsc C s� t j|d�}z�| j| j� x�tj| j�D ]~\}}}|| jkrT| rTd}t|| j ��xP|D ]H}tjj||�}|t | j�d � j
tjj�} tjj| |�}
|j||
� qZW q(W W d |j
� X d S )N�wz'no files found in upload directory '%s')�zipfileZZipFileZmkpathr r"