File tree Expand file tree Collapse file tree 4 files changed +28
-30
lines changed
Expand file tree Collapse file tree 4 files changed +28
-30
lines changed Original file line number Diff line number Diff line change 22from __future__ import absolute_import
33import sys
44__future_module__ = True
5-
6- from future .moves import import_top_level_modules
5+ from future .standard_library import import_top_level_modules
76
87if sys .version_info [0 ] == 3 :
98 import_top_level_modules ()
Original file line number Diff line number Diff line change 22from __future__ import absolute_import
33import sys
44__future_module__ = True
5-
6- TOP_LEVEL_MODULES = ['builtins' ,
7- 'configparser' ,
8- 'copyreg' ,
9- 'html' ,
10- 'http' ,
11- 'queue' ,
12- 'reprlib' ,
13- 'socketserver' ,
14- 'test' ,
15- 'tkinter' ,
16- 'winreg' ,
17- 'xmlrpc' ,
18- '_dummy_thread' ,
19- '_markupbase' ,
20- '_thread' ,
21- ]
22-
23- def import_top_level_modules ():
24- from future .standard_library import exclude_local_folder_imports
25- with exclude_local_folder_imports (* TOP_LEVEL_MODULES ):
26- for m in TOP_LEVEL_MODULES :
27- try :
28- __import__ (m )
29- except ImportError : # e.g. winreg
30- pass
5+ from future .standard_library import import_top_level_modules
316
327if sys .version_info [0 ] == 3 :
338 import_top_level_modules ()
Original file line number Diff line number Diff line change @@ -784,3 +784,28 @@ def __exit__(self, *args):
784784 sys .path = self .old_sys_path
785785 for m in set (self .old_sys_modules .keys ()) - set (sys .modules .keys ()):
786786 sys .modules [m ] = self .old_sys_modules [m ]
787+
788+ TOP_LEVEL_MODULES = ['builtins' ,
789+ 'configparser' ,
790+ 'copyreg' ,
791+ 'html' ,
792+ 'http' ,
793+ 'queue' ,
794+ 'reprlib' ,
795+ 'socketserver' ,
796+ 'test' ,
797+ 'tkinter' ,
798+ 'winreg' ,
799+ 'xmlrpc' ,
800+ '_dummy_thread' ,
801+ '_markupbase' ,
802+ '_thread' ,
803+ ]
804+
805+ def import_top_level_modules ():
806+ with exclude_local_folder_imports (* TOP_LEVEL_MODULES ):
807+ for m in TOP_LEVEL_MODULES :
808+ try :
809+ __import__ (m )
810+ except ImportError : # e.g. winreg
811+ pass
Original file line number Diff line number Diff line change 55import sys
66
77import future
8- import future .moves # to allow running this script in the python-future source folder
98from future .standard_library import exclude_local_folder_imports
109
1110
12- with exclude_local_folder_imports ('configparser' ):
11+ with exclude_local_folder_imports ('configparser' , 'reprlib' ):
1312 try :
1413 from setuptools import setup
1514 except ImportError :
You can’t perform that action at this time.
0 commit comments