From 7a786ff84f2e7444889db9afe542498025afe117 Mon Sep 17 00:00:00 2001 From: Ralf Schmitt Date: Mon, 18 Feb 2013 23:23:13 +0100 Subject: [PATCH] make the standalone version work with jython 2.5.3 --- pypi-server-in.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pypi-server-in.py b/pypi-server-in.py index e629d3a..d0ca1d4 100755 --- a/pypi-server-in.py +++ b/pypi-server-in.py @@ -26,7 +26,11 @@ class DictImporter(object): is_pkg = True co = compile(s, fullname, 'exec') - module = sys.modules.setdefault(fullname, type(sys)(fullname)) + try: + module = sys.modules.setdefault(fullname, type(sys)(fullname)) + except TypeError: # jython? + import types + module = sys.modules.setdefault(fullname, types.ModuleType(fullname)) module.__file__ = __file__ module.__loader__ = self if is_pkg: