Skip to content

Commit 913ade1

Browse files
committed
Fix running of scripts from python-future source folder on Py3
1 parent d288411 commit 913ade1

File tree

25 files changed

+73
-63
lines changed

25 files changed

+73
-63
lines changed

_dummy_thread/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@
55
if sys.version_info[0] < 3:
66
from dummy_thread import *
77
else:
8-
from future.standard_library import exclude_local_folder_imports
9-
with exclude_local_folder_imports('_dummy_thread'):
10-
from _dummy_thread import *
8+
raise ImportError('Cannot import module from python-future source folder')

_markupbase/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@
55
if sys.version_info[0] < 3:
66
from markupbase import *
77
else:
8-
from future.standard_library import exclude_local_folder_imports
9-
with exclude_local_folder_imports('_markupbase'):
10-
from _markupbase import *
8+
raise ImportError('Cannot import module from python-future source folder')

_thread/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@
55
if sys.version_info[0] < 3:
66
from dummy_thread import *
77
else:
8-
from future.standard_library import exclude_local_folder_imports
9-
with exclude_local_folder_imports('_dummy_thread'):
10-
from _dummy_thread import *
8+
raise ImportError('Cannot import module from python-future source folder')

builtins/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@
77
# Overwrite any old definitions with the equivalent future.builtins ones:
88
from future.builtins import *
99
else:
10-
from future.standard_library import exclude_local_folder_imports
11-
with exclude_local_folder_imports('builtins'):
12-
from builtins import *
10+
raise ImportError('Cannot import module from python-future source folder')

configparser/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44
if sys.version_info[0] < 3:
55
from ConfigParser import *
66
else:
7-
from future.standard_library import exclude_local_folder_imports
8-
with exclude_local_folder_imports('configparser'):
9-
from configparser import *
7+
raise ImportError('Cannot import module from python-future source folder')

copyreg/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from future.utils import PY3
33

44
if PY3:
5+
raise ImportError('Cannot import module from python-future source folder')
56
from copyreg import *
67
else:
78
__future_module__ = True

future/moves/__init__.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,29 @@
11
# future.moves package
2+
from __future__ import absolute_import
3+
import sys
4+
__future_module__ = True
5+
6+
TOP_LEVEL_MODULES = ['builtins',
7+
'configparser',
8+
'copyreg',
9+
'html',
10+
'http',
11+
'queue',
12+
'reprlib',
13+
'socketserver',
14+
'tkinter',
15+
'winreg',
16+
'xmlrpc',
17+
'_dummy_thread',
18+
'_markupbase',
19+
'_thread',
20+
]
21+
22+
if sys.version_info[0] == 3:
23+
from future.standard_library import exclude_local_folder_imports
24+
with exclude_local_folder_imports(*TOP_LEVEL_MODULES):
25+
for m in TOP_LEVEL_MODULES:
26+
try:
27+
__import__(m)
28+
except ImportError: # e.g. winreg
29+
pass

future/moves/collections.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from __future__ import absolute_import
2+
from future.utils import PY2, PY26
3+
__future_module__ = True
24

35
from collections import *
46

5-
from future.utils import PY2, PY26
6-
77
if PY2:
88
from UserDict import UserDict
99
from UserList import UserList

future/moves/html/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from __future__ import absolute_import, unicode_literals
22
from future.utils import PY3
3+
__future_module__ = True
34

45
if PY3:
56
from html import *
67
else:
7-
__future_module__ = True
88

99
# cgi.escape isn't good enough for the single Py3.3 html test to pass.
1010
# Define it inline here instead. From the Py3.3 stdlib

future/moves/html/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from __future__ import absolute_import
22
from future.utils import PY3
3+
__future_module__ = True
34

45
if PY3:
56
from html.parser import *
67
else:
7-
__future_module__ = True
88
from HTMLParser import *

0 commit comments

Comments
 (0)