summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--paste/app_setup.py6
-rw-r--r--paste/fixture.py6
-rw-r--r--paste/flup_session.py2
-rw-r--r--paste/pyconfig.py6
-rwxr-xr-xpaste/tests/doctest_webapp.py2
-rw-r--r--paste/util/thirdparty.py55
6 files changed, 12 insertions, 65 deletions
diff --git a/paste/app_setup.py b/paste/app_setup.py
index cf85e8c..666e194 100644
--- a/paste/app_setup.py
+++ b/paste/app_setup.py
@@ -14,8 +14,10 @@ except ImportError:
# Not available on Windows?
pass
-from paste.util.thirdparty import load_new_module
-string = load_new_module('string', (2, 4))
+if sys.version < (2, 4):
+ from paste.util import string24 as string
+else:
+ import string
from paste import pyconfig
from paste import urlparser
diff --git a/paste/fixture.py b/paste/fixture.py
index 0e722b5..abf2e91 100644
--- a/paste/fixture.py
+++ b/paste/fixture.py
@@ -14,8 +14,10 @@ except ImportError:
from StringIO import StringIO
import re
#from py.test.collect import Module, PyCollector
-from paste.util import thirdparty
-doctest = thirdparty.load_new_module('doctest', (2, 4))
+if sys.version < (2, 4):
+ from paste.util import doctest24 as doctest
+else:
+ import doctest
from paste import wsgilib
from paste import lint
from paste import pyconfig
diff --git a/paste/flup_session.py b/paste/flup_session.py
index b4b4caf..8b28282 100644
--- a/paste/flup_session.py
+++ b/paste/flup_session.py
@@ -13,8 +13,6 @@ data.
import httpexceptions
import wsgilib
-from paste.util import thirdparty
-thirdparty.add_package('flup')
import flup.middleware.session
flup_session = flup.middleware.session
diff --git a/paste/pyconfig.py b/paste/pyconfig.py
index f3e254e..6823e9c 100644
--- a/paste/pyconfig.py
+++ b/paste/pyconfig.py
@@ -19,8 +19,10 @@ __all__ = ['Config', 'setup_config', 'parse_commandline',
import types
import os
import sys
-from paste.util import thirdparty
-UserDict = thirdparty.load_new_module('UserDict', (2, 3))
+if sys.version_info < (2, 3):
+ from paste.util import UserDict24 as UserDict
+else:
+ import UserDict
from paste.reloader import watch_file
from paste.util.threadinglocal import local
import threading
diff --git a/paste/tests/doctest_webapp.py b/paste/tests/doctest_webapp.py
index f151f9c..a8a63c9 100755
--- a/paste/tests/doctest_webapp.py
+++ b/paste/tests/doctest_webapp.py
@@ -14,8 +14,6 @@ import rfc822
from cStringIO import StringIO
from paste import server
from paste import wsgilib
-from paste.util.thirdparty import add_package
-add_package('PySourceColor')
import PySourceColor
diff --git a/paste/util/thirdparty.py b/paste/util/thirdparty.py
deleted file mode 100644
index 7944ede..0000000
--- a/paste/util/thirdparty.py
+++ /dev/null
@@ -1,55 +0,0 @@
-import sys
-import os
-
-third_party = os.path.join(
- os.path.dirname(os.path.dirname(__file__)),
- '3rd-party')
-
-new_python_path = os.path.join(third_party, 'new_python')
-
-def load_new_module(module_name, python_version):
- """
- Modules in the standard library that have been improved can be
- loaded with this command. python_version is a sys.version_info
- tuple, and if you need a newer version then we'll look in
- ../3rd-party/new_python/python/module.py; otherwise it'll return
- the normal module. E.g.:
-
- doctest = load_new_module('doctest', (2, 4))
- """
- if python_version > sys.version_info:
- if new_python_path not in sys.path:
- sys.path.append(new_python_path)
- try:
- exec "import python.%s as generic_module" % module_name
- except ImportError, e:
- raise ImportError(
- "Cannot load backported (from python version %s) "
- "stdlib module %s; expected to find it in %s"
- % ('.'.join(map(str, python_version)),
- module_name,
- os.path.join(new_python_path, 'python')))
- else:
- exec "import %s as generic_module" % module_name
- return generic_module
-
-def add_package(package_name):
- """
- If package_name has not been installed, we add the appropriate
- path from ../3rd-party/package_name-files
-
- *After* calling this function you can import the package on your
- own, either from the package the user installed, or from the
- package we distribute.
- """
- try:
- exec "import %s" % package_name
- except ImportError, e:
- path = os.path.join(third_party, '%s-files' % package_name)
- if os.path.exists(path):
- sys.path.append(path)
- else:
- raise ImportError(
- "Cannot load the package %s; expected to find it in "
- "%s. Have you run build-pkg.py? (import gave error: %s)"
- % (package_name, path, e))