Skip to content

Commit c149468

Browse files
committed
Merge pull request #10943 from pradyunsg/downgrade-distlib
Downgrade to distlib 0.3.3
1 parent 6c17e27 commit c149468

20 files changed

+4392
-71
lines changed

news/distlib.vendor.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Downgrade distlib to 0.3.3.

src/pip/_vendor/distlib/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
import logging
88

9-
__version__ = '0.3.4'
9+
__version__ = '0.3.3'
1010

1111
class DistlibException(Exception):
1212
pass
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""Modules copied from Python 3 standard libraries, for internal use only.
2+
3+
Individual classes and functions are found in d2._backport.misc. Intended
4+
usage is to always import things missing from 3.1 from that module: the
5+
built-in/stdlib objects will be used if found.
6+
"""
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Copyright (C) 2012 The Python Software Foundation.
4+
# See LICENSE.txt and CONTRIBUTORS.txt.
5+
#
6+
"""Backports for individual classes and functions."""
7+
8+
import os
9+
import sys
10+
11+
__all__ = ['cache_from_source', 'callable', 'fsencode']
12+
13+
14+
try:
15+
from imp import cache_from_source
16+
except ImportError:
17+
def cache_from_source(py_file, debug=__debug__):
18+
ext = debug and 'c' or 'o'
19+
return py_file + ext
20+
21+
22+
try:
23+
callable = callable
24+
except NameError:
25+
from collections import Callable
26+
27+
def callable(obj):
28+
return isinstance(obj, Callable)
29+
30+
31+
try:
32+
fsencode = os.fsencode
33+
except AttributeError:
34+
def fsencode(filename):
35+
if isinstance(filename, bytes):
36+
return filename
37+
elif isinstance(filename, str):
38+
return filename.encode(sys.getfilesystemencoding())
39+
else:
40+
raise TypeError("expect bytes or str, not %s" %
41+
type(filename).__name__)

0 commit comments

Comments
 (0)