Orbits
1
|
Public Member Functions | |
def | __init__ |
def | read_configuration |
def | save_configuration |
def | check_credentials |
def | register |
def | get_sign_command |
def | run_command |
def | sign_file |
def | upload_file |
def | upload_documentation |
def | get_verify_command |
def | verify_signature |
def | download_file |
def | send_request |
def | encode_request |
def | search |
Public Attributes | |
url | |
password_handler | |
ssl_verifier | |
gpg | |
gpg_home | |
rpc_proxy | |
username | |
password | |
realm | |
Static Public Attributes | |
string | boundary = b'----------ThIs_Is_tHe_distlib_index_bouNdaRY_$' |
Private Member Functions | |
def | _get_pypirc_command |
def | _reader |
This class represents a package index compatible with PyPI, the Python Package Index.
def pip._vendor.distlib.index.PackageIndex.__init__ | ( | self, | |
url = None |
|||
) |
Initialise an instance. :param url: The URL of the index. If not specified, the URL for PyPI is used.
|
private |
Get the distutils command for interacting with PyPI configurations. :return: the command.
|
private |
Thread runner for reading lines of from a subprocess into a buffer. :param name: The logical name of the stream (used for logging only). :param stream: The stream to read from. This will typically a pipe connected to the output stream of a subprocess. :param outbuf: The list to append the read lines to.
def pip._vendor.distlib.index.PackageIndex.check_credentials | ( | self | ) |
Check that ``username`` and ``password`` have been set, and raise an exception if not.
def pip._vendor.distlib.index.PackageIndex.download_file | ( | self, | |
url, | |||
destfile, | |||
digest = None , |
|||
reporthook = None |
|||
) |
This is a convenience method for downloading a file from an URL. Normally, this will be a file from the index, though currently no check is made for this (i.e. a file can be downloaded from anywhere). The method is just like the :func:`urlretrieve` function in the standard library, except that it allows digest computation to be done during download and checking that the downloaded data matched any expected value. :param url: The URL of the file to be downloaded (assumed to be available via an HTTP GET request). :param destfile: The pathname where the downloaded file is to be saved. :param digest: If specified, this must be a (hasher, value) tuple, where hasher is the algorithm used (e.g. ``'md5'``) and ``value`` is the expected value. :param reporthook: The same as for :func:`urlretrieve` in the standard library.
def pip._vendor.distlib.index.PackageIndex.encode_request | ( | self, | |
fields, | |||
files | |||
) |
Encode fields and files for posting to an HTTP server. :param fields: The fields to send as a list of (fieldname, value) tuples. :param files: The files to send as a list of (fieldname, filename, file_bytes) tuple.
def pip._vendor.distlib.index.PackageIndex.get_sign_command | ( | self, | |
filename, | |||
signer, | |||
sign_password | |||
) |
Return a suitable command for signing a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :return: The signing command as a list suitable to be passed to :class:`subprocess.Popen`.
def pip._vendor.distlib.index.PackageIndex.get_verify_command | ( | self, | |
signature_filename, | |||
data_filename | |||
) |
Return a suitable command for verifying a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :return: The verifying command as a list suitable to be passed to :class:`subprocess.Popen`.
def pip._vendor.distlib.index.PackageIndex.read_configuration | ( | self | ) |
Read the PyPI access configuration as supported by distutils, getting PyPI to do the acutal work. This populates ``username``, ``password``, ``realm`` and ``url`` attributes from the configuration.
def pip._vendor.distlib.index.PackageIndex.register | ( | self, | |
metadata | |||
) |
Register a distribution on PyPI, using the provided metadata. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the distribution to be registered. :return: The HTTP response received from PyPI upon submission of the request.
def pip._vendor.distlib.index.PackageIndex.run_command | ( | self, | |
cmd, | |||
input_data = None |
|||
) |
Run a command in a child process , passing it any input data specified. :param cmd: The command to run. :param input_data: If specified, this must be a byte string containing data to be sent to the child process. :return: A tuple consisting of the subprocess' exit code, a list of lines read from the subprocess' ``stdout``, and a list of lines read from the subprocess' ``stderr``.
def pip._vendor.distlib.index.PackageIndex.save_configuration | ( | self | ) |
Save the PyPI access configuration. You must have set ``username`` and ``password`` attributes before calling this method. Again, distutils is used to do the actual work.
def pip._vendor.distlib.index.PackageIndex.search | ( | self, | |
terms, | |||
operator = None |
|||
) |
def pip._vendor.distlib.index.PackageIndex.send_request | ( | self, | |
req | |||
) |
Send a standard library :class:`Request` to PyPI and return its response. :param req: The request to send. :return: The HTTP response from PyPI (a standard library HTTPResponse).
def pip._vendor.distlib.index.PackageIndex.sign_file | ( | self, | |
filename, | |||
signer, | |||
sign_password | |||
) |
Sign a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :return: The absolute pathname of the file where the signature is stored.
def pip._vendor.distlib.index.PackageIndex.upload_documentation | ( | self, | |
metadata, | |||
doc_dir | |||
) |
Upload documentation to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the documentation to be uploaded. :param doc_dir: The pathname of the directory which contains the documentation. This should be the directory that contains the ``index.html`` for the documentation. :return: The HTTP response received from PyPI upon submission of the request.
def pip._vendor.distlib.index.PackageIndex.upload_file | ( | self, | |
metadata, | |||
filename, | |||
signer = None , |
|||
sign_password = None , |
|||
filetype = 'sdist' , |
|||
pyversion = 'source' |
|||
) |
Upload a release file to the index. :param metadata: A :class:`Metadata` instance defining at least a name and version number for the file to be uploaded. :param filename: The pathname of the file to be uploaded. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param filetype: The type of the file being uploaded. This is the distutils command which produced that file, e.g. ``sdist`` or ``bdist_wheel``. :param pyversion: The version of Python which the release relates to. For code compatible with any Python, this would be ``source``, otherwise it would be e.g. ``3.2``. :return: The HTTP response received from PyPI upon submission of the request.
def pip._vendor.distlib.index.PackageIndex.verify_signature | ( | self, | |
signature_filename, | |||
data_filename | |||
) |
Verify a signature for a file. :param signature_filename: The pathname to the file containing the signature. :param data_filename: The pathname to the file containing the signed data. :return: True if the signature was verified, else False.
|
static |
pip._vendor.distlib.index.PackageIndex.gpg |
pip._vendor.distlib.index.PackageIndex.gpg_home |
pip._vendor.distlib.index.PackageIndex.password |
pip._vendor.distlib.index.PackageIndex.password_handler |
pip._vendor.distlib.index.PackageIndex.realm |
pip._vendor.distlib.index.PackageIndex.rpc_proxy |
pip._vendor.distlib.index.PackageIndex.ssl_verifier |
pip._vendor.distlib.index.PackageIndex.url |
pip._vendor.distlib.index.PackageIndex.username |
Copyright 2014 Google Inc. All rights reserved.