コード例 #1
0
def egg_info_for_url(url):
    scheme, server, path, parameters, query, fragment = urlparse(url)
    base = unquote(path.split('/')[-1])
    if server=='sourceforge.net' and base=='download':    # XXX Yuck
        base = unquote(path.split('/')[-2])
    if '#' in base: base, fragment = base.split('#',1)
    return base,fragment
コード例 #2
0
def egg_info_for_url(url):
    scheme, server, path, parameters, query, fragment = urlparse(url)
    base = unquote(path.split('/')[-1])
    if server == 'sourceforge.net' and base == 'download':  # XXX Yuck
        base = unquote(path.split('/')[-2])
    if '#' in base: base, fragment = base.split('#', 1)
    return base, fragment
コード例 #3
0
def _encode_auth(auth):
    """
    A function compatible with Python 2.3-3.3 that will encode
    auth from a URL suitable for an HTTP header.
    >>> _encode_auth('username%3Apassword')
    u'dXNlcm5hbWU6cGFzc3dvcmQ='
    """
    auth_s = unquote(auth)
    # convert to bytes
    auth_bytes = auth_s.encode()
    # use the legacy interface for Python 2.3 support
    encoded_bytes = base64.encodestring(auth_bytes)
    # convert back to a string
    encoded = encoded_bytes.decode()
    # strip the trailing carriage return
    return encoded.rstrip()
コード例 #4
0
def _encode_auth(auth):
    """
    A function compatible with Python 2.3-3.3 that will encode
    auth from a URL suitable for an HTTP header.
    >>> _encode_auth('username%3Apassword')
    u'dXNlcm5hbWU6cGFzc3dvcmQ='
    """
    auth_s = unquote(auth)
    # convert to bytes
    auth_bytes = auth_s.encode()
    # use the legacy interface for Python 2.3 support
    encoded_bytes = base64.encodestring(auth_bytes)
    # convert back to a string
    encoded = encoded_bytes.decode()
    # strip the trailing carriage return
    return encoded.rstrip()
コード例 #5
0
def _encode_auth(auth):
    """
    A function compatible with Python 2.3-3.3 that will encode
    auth from a URL suitable for an HTTP header.
    >>> str(_encode_auth('username%3Apassword'))
    'dXNlcm5hbWU6cGFzc3dvcmQ='

    Long auth strings should not cause a newline to be inserted.
    >>> long_auth = 'username:'******'password'*10
    >>> chr(10) in str(_encode_auth(long_auth))
    False
    """
    auth_s = unquote(auth)
    # convert to bytes
    auth_bytes = auth_s.encode()
    # use the legacy interface for Python 2.3 support
    encoded_bytes = base64.encodestring(auth_bytes)
    # convert back to a string
    encoded = encoded_bytes.decode()
    # strip the trailing carriage return
    return encoded.replace('\n','')
コード例 #6
0
def _encode_auth(auth):
    """
    A function compatible with Python 2.3-3.3 that will encode
    auth from a URL suitable for an HTTP header.
    >>> str(_encode_auth('username%3Apassword'))
    'dXNlcm5hbWU6cGFzc3dvcmQ='

    Long auth strings should not cause a newline to be inserted.
    >>> long_auth = 'username:'******'password'*10
    >>> chr(10) in str(_encode_auth(long_auth))
    False
    """
    auth_s = unquote(auth)
    # convert to bytes
    auth_bytes = auth_s.encode()
    # use the legacy interface for Python 2.3 support
    encoded_bytes = base64.encodestring(auth_bytes)
    # convert back to a string
    encoded = encoded_bytes.decode()
    # strip the trailing carriage return
    return encoded.replace('\n', '')
コード例 #7
0
            base = name[:-16]
            plat = 'win32'
        elif lower.endswith('.win-amd64.exe'):
            base = name[:-14]
            plat = 'win-amd64'
        elif lower.startswith('.win-amd64-py',-20):
            py_ver = name[-7:-4]
            base = name[:-20]
            plat = 'win-amd64'
    return base,py_ver,plat


def egg_info_for_url(url):
<<<<<<< HEAD
    scheme, server, path, parameters, query, fragment = urlparse(url)
    base = unquote(path.split('/')[-1])
    if server=='sourceforge.net' and base=='download':    # XXX Yuck
        base = unquote(path.split('/')[-2])
=======
    parts = urllib.parse.urlparse(url)
    scheme, server, path, parameters, query, fragment = parts
    base = urllib.parse.unquote(path.split('/')[-1])
    if server=='sourceforge.net' and base=='download':    # XXX Yuck
        base = urllib.parse.unquote(path.split('/')[-2])
>>>>>>> 54eef0be98b1b67c8507db91f4cfa90b64991027
    if '#' in base: base, fragment = base.split('#',1)
    return base,fragment

def distros_for_url(url, metadata=None):
    """Yield egg or source distribution objects that might be found at a URL"""
    base, fragment = egg_info_for_url(url)