File tree 3 files changed +28
-12
lines changed 3 files changed +28
-12
lines changed Original file line number Diff line number Diff line change
1
+ Fix vendored dependencies so importing ``setuptools.extern.some_module `` gives the same object as ``setuptools._vendor.some_module ``. This makes Metadata picklable again.
Original file line number Diff line number Diff line change @@ -43,23 +43,16 @@ def load_module(self, fullname):
43
43
__import__ (extant )
44
44
mod = sys .modules [extant ]
45
45
sys .modules [fullname ] = mod
46
- # mysterious hack:
47
- # Remove the reference to the extant package/module
48
- # on later Python versions to cause relative imports
49
- # in the vendor package to resolve the same modules
50
- # as those going through this importer.
51
- if sys .version_info >= (3 , ):
52
- del sys .modules [extant ]
53
46
return mod
54
47
except ImportError :
55
48
pass
56
49
else :
57
50
raise ImportError (
58
- "The '{target}' package is required; "
59
- "normally this is bundled with this package so if you get "
60
- "this warning, consult the packager of your "
61
- "distribution." .format (** locals ())
62
- )
51
+ "The '{target}' package is required; "
52
+ "normally this is bundled with this package so if you get "
53
+ "this warning, consult the packager of your "
54
+ "distribution." .format (** locals ())
55
+ )
63
56
64
57
def install (self ):
65
58
"""
Original file line number Diff line number Diff line change
1
+ import importlib
2
+ import pickle
3
+
4
+ from setuptools import Distribution
5
+ from setuptools .extern import ordered_set
6
+ from setuptools .tests import py3_only
7
+
8
+
9
+ def test_reimport_extern ():
10
+ ordered_set2 = importlib .import_module (ordered_set .__name__ )
11
+ assert ordered_set is ordered_set2
12
+
13
+
14
+ def test_orderedset_pickle_roundtrip ():
15
+ o1 = ordered_set .OrderedSet ([1 , 2 , 5 ])
16
+ o2 = pickle .loads (pickle .dumps (o1 ))
17
+ assert o1 == o2
18
+
19
+
20
+ @py3_only
21
+ def test_distribution_picklable ():
22
+ pickle .loads (pickle .dumps (Distribution ()))
You can’t perform that action at this time.
0 commit comments