(self, url=None)
Initialise an instance.

        :param url: The URL of the index. If not specified, the URL for PyPI is
                    used.
Initialise an instance.
Initialise an instance .
def __init__(self, url=None):
        """
        Initialise an instance.

        :param url: The URL of the index. If not specified, the URL for PyPI is
                    used.
        """
        self.url = url or DEFAULT_INDEX
        self.read_configuration()
        scheme, netloc, path, params, query, frag = urlparse(self.url)
        if params or query or frag or scheme not in ('http', 'https'):
            raise DistlibException('invalid repository: %s' % self.url)
        self.password_handler = None
        self.ssl_verifier = None
        self.gpg = None
        self.gpg_home = None
        with open(os.devnull, 'w') as sink:
            # Use gpg by default rather than gpg2, as gpg2 insists on
            # prompting for passwords
            for s in ('gpg', 'gpg2'):
                try:
                    rc = subprocess.check_call([s, '--version'], stdout=sink,
                                               stderr=sink)
                    if rc == 0:
                        self.gpg = s
                        break
                except OSError:
                    pass
def __init__ ( self , url = None ) : self . url = url or DEFAULT_INDEX self . read_configuration ( ) scheme , netloc , path , params , query , frag = urlparse ( self . url ) if params or query or frag or scheme not in ( 'http' , 'https' ) : raise DistlibException ( 'invalid repository: %s' % self . url ) self . password_handler = None self . ssl_verifier = None self . gpg = None self . gpg_home = None with open ( os . devnull , 'w' ) as sink : # Use gpg by default rather than gpg2, as gpg2 insists on # prompting for passwords for s in ( 'gpg' , 'gpg2' ) : try : rc = subprocess . check_call ( [ s , '--version' ] , stdout = sink , stderr = sink ) if rc == 0 : self . gpg = s break except OSError : pass