Commit 7ee68f0c authored by Martin v. Löwis's avatar Martin v. Löwis

Use types.ModuleType instead of new.module.

--HG--
branch : distribute
extra : rebase_source : 3327441a867ad2878553ed1d42418a7e68ee3067
parent 6badc540
......@@ -13,7 +13,7 @@ The package resource API is designed to work with normal filesystem packages,
method.
"""
import sys, os, zipimport, time, re, imp, new
import sys, os, zipimport, time, re, imp, types
try:
frozenset
......@@ -1707,7 +1707,7 @@ def _handle_ns(packageName, path_item):
return None
module = sys.modules.get(packageName)
if module is None:
module = sys.modules[packageName] = new.module(packageName)
module = sys.modules[packageName] = types.ModuleType(packageName)
module.__path__ = []; _set_parent_ns(packageName)
elif not hasattr(module,'__path__'):
raise TypeError("Not a package:", packageName)
......
......@@ -97,12 +97,12 @@ class install_egg_info(Command):
% ('.'.join(pth[:-1]), pth[-1])
)
f.write(
"import sys,new,os; "
"import sys,types,os; "
"p = os.path.join(sys._getframe(1).f_locals['sitedir'], "
"*%(pth)r); "
"ie = os.path.exists(os.path.join(p,'__init__.py')); "
"m = not ie and "
"sys.modules.setdefault(%(pkg)r,new.module(%(pkg)r)); "
"sys.modules.setdefault(%(pkg)r,types.ModuleType(%(pkg)r)); "
"mp = (m or []) and m.__dict__.setdefault('__path__',[]); "
"(p not in mp) and mp.append(p)%(trailer)s"
% locals()
......
......@@ -2053,16 +2053,16 @@ class Tester:
return (f,t)
def rundict(self, d, name, module=None):
import new
m = new.module(name)
import types
m = types.ModuleType(name)
m.__dict__.update(d)
if module is None:
module = False
return self.rundoc(m, name, module)
def run__test__(self, d, name):
import new
m = new.module(name)
import types
m = types.ModuleType(name)
m.__test__ = d
return self.rundoc(m, name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment