From 261328d59cbbf66646e4ea137bb1211d1f4dccf4 2011-03-13 13:28:25 From: Thomas Spura Date: 2011-03-13 13:28:25 Subject: [PATCH] Unbundle of all external modules. Move all libraries in external into subfolders and place a custom __init__.py into each of them. This way the system installed ones are tried first, before falling back to the bundled ones. Now every distribution can properly depend on the upstream library. (e.g. bundled libraries are not allowed in fedora) Signed-off-by: Toshio Ernie Kuratomi Signed-off-by: Thomas Spura --- diff --git a/IPython/external/Itpl.py b/IPython/external/Itpl/_Itpl.py similarity index 100% rename from IPython/external/Itpl.py rename to IPython/external/Itpl/_Itpl.py diff --git a/IPython/external/Itpl/__init__.py b/IPython/external/Itpl/__init__.py new file mode 100644 index 0000000..9d94715 --- /dev/null +++ b/IPython/external/Itpl/__init__.py @@ -0,0 +1,4 @@ +try: + from Itpl import * +except ImportError: + from _Itpl import * diff --git a/IPython/external/argparse/__init__.py b/IPython/external/argparse/__init__.py new file mode 100644 index 0000000..fce14e6 --- /dev/null +++ b/IPython/external/argparse/__init__.py @@ -0,0 +1,12 @@ +try: + import argparse + # Workaround an argparse bug, FIXED in argparse 1.1.0 + if 'RawTextHelpFormatterArgumentDefaultsHelpFormatter' in argparse.__all__: + import itertools + argparse.__all__ = list(itertools.chain( [i for i in argparse.__all__ + if i != 'RawTextHelpFormatterArgumentDefaultsHelpFormatter'], + ['RawTextHelpFormatter', 'ArgumentDefaultsHelpFormatter'])) + argparse.__all__.append('SUPPRESS') + from argparse import * +except ImportError: + from _argparse import * diff --git a/IPython/external/argparse.py b/IPython/external/argparse/_argparse.py similarity index 100% rename from IPython/external/argparse.py rename to IPython/external/argparse/_argparse.py diff --git a/IPython/external/configobj/__init__.py b/IPython/external/configobj/__init__.py new file mode 100644 index 0000000..70678bd --- /dev/null +++ b/IPython/external/configobj/__init__.py @@ -0,0 +1,4 @@ +try: + from configobj import * +except ImportError: + from _configobj import * diff --git a/IPython/external/configobj.py b/IPython/external/configobj/_configobj.py similarity index 100% rename from IPython/external/configobj.py rename to IPython/external/configobj/_configobj.py diff --git a/IPython/external/decorator/__init__.py b/IPython/external/decorator/__init__.py new file mode 100644 index 0000000..df568fb --- /dev/null +++ b/IPython/external/decorator/__init__.py @@ -0,0 +1,8 @@ +try: + from decorator import * + from decorator import getinfo, new_wrapper + # the following funcion is deprecated so using the python own one + from functools import update_wrapper +except ImportError: + from _decorator import * + from _decorator import getinfo, update_wrapper, new_wrapper diff --git a/IPython/external/decorator.py b/IPython/external/decorator/_decorator.py similarity index 100% rename from IPython/external/decorator.py rename to IPython/external/decorator/_decorator.py diff --git a/IPython/external/decorators/__init__.py b/IPython/external/decorators/__init__.py new file mode 100644 index 0000000..d027829 --- /dev/null +++ b/IPython/external/decorators/__init__.py @@ -0,0 +1,4 @@ +try: + from numpy.testing.decorators import * +except ImportError: + from _decorators.py import * diff --git a/IPython/external/decorators.py b/IPython/external/decorators/_decorators.py similarity index 100% rename from IPython/external/decorators.py rename to IPython/external/decorators/_decorators.py diff --git a/IPython/external/_numpy_testing_utils.py b/IPython/external/decorators/_numpy_testing_utils.py similarity index 100% rename from IPython/external/_numpy_testing_utils.py rename to IPython/external/decorators/_numpy_testing_utils.py diff --git a/IPython/external/guid/__init__.py b/IPython/external/guid/__init__.py new file mode 100644 index 0000000..bb40c41 --- /dev/null +++ b/IPython/external/guid/__init__.py @@ -0,0 +1,4 @@ +try: + from guid import * +except ImportError: + from _guid import * diff --git a/IPython/external/guid.py b/IPython/external/guid/_guid.py similarity index 100% rename from IPython/external/guid.py rename to IPython/external/guid/_guid.py diff --git a/IPython/external/mglob/__init__.py b/IPython/external/mglob/__init__.py new file mode 100644 index 0000000..28494fd --- /dev/null +++ b/IPython/external/mglob/__init__.py @@ -0,0 +1,4 @@ +try: + from mglob import * +except ImportError: + from _mglob import * diff --git a/IPython/external/mglob.py b/IPython/external/mglob/_mglob.py similarity index 91% rename from IPython/external/mglob.py rename to IPython/external/mglob/_mglob.py old mode 100755 new mode 100644 index 08f4194..44a3b49 --- a/IPython/external/mglob.py +++ b/IPython/external/mglob/_mglob.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - r""" mglob - enhanced file list expansion module Use as stand-alone utility (for xargs, `backticks` etc.), diff --git a/IPython/external/path/__init__.py b/IPython/external/path/__init__.py new file mode 100644 index 0000000..bd03f5d --- /dev/null +++ b/IPython/external/path/__init__.py @@ -0,0 +1,4 @@ +try: + from path import * +except ImportError: + from _path import * diff --git a/IPython/external/path.py b/IPython/external/path/_path.py similarity index 100% rename from IPython/external/path.py rename to IPython/external/path/_path.py diff --git a/IPython/external/pretty/__init__.py b/IPython/external/pretty/__init__.py new file mode 100644 index 0000000..dac92d4 --- /dev/null +++ b/IPython/external/pretty/__init__.py @@ -0,0 +1,4 @@ +try: + from pretty import * +except ImportError: + from _pretty import * diff --git a/IPython/external/pretty.py b/IPython/external/pretty/_pretty.py similarity index 100% rename from IPython/external/pretty.py rename to IPython/external/pretty/_pretty.py diff --git a/IPython/external/pyparsing/__init__.py b/IPython/external/pyparsing/__init__.py new file mode 100644 index 0000000..e8f0fda --- /dev/null +++ b/IPython/external/pyparsing/__init__.py @@ -0,0 +1,4 @@ +try: + from pyparsing import * +except ImportError: + from _pyparsing import * diff --git a/IPython/external/pyparsing.py b/IPython/external/pyparsing/_pyparsing.py similarity index 100% rename from IPython/external/pyparsing.py rename to IPython/external/pyparsing/_pyparsing.py diff --git a/IPython/external/simplegeneric/__init__.py b/IPython/external/simplegeneric/__init__.py new file mode 100644 index 0000000..be48f27 --- /dev/null +++ b/IPython/external/simplegeneric/__init__.py @@ -0,0 +1,4 @@ +try: + from simplegeneric import * +except ImportError: + from _simplegeneric import * diff --git a/IPython/external/simplegeneric.py b/IPython/external/simplegeneric/_simplegeneric.py similarity index 100% rename from IPython/external/simplegeneric.py rename to IPython/external/simplegeneric/_simplegeneric.py diff --git a/IPython/external/validate/__init__.py b/IPython/external/validate/__init__.py new file mode 100644 index 0000000..30840ce --- /dev/null +++ b/IPython/external/validate/__init__.py @@ -0,0 +1,8 @@ +try: + import validate + if '__docformat__' in validate.__all__ and validate.__version__.split('.') >= ['1', '0', '1']: + # __docformat__ was removed in 1.0.1 but + validate.__all__ = [i for i in validate.__all__ if i != '__docformat__'] + from validate import * +except ImportError: + from _validate import * diff --git a/IPython/external/validate.py b/IPython/external/validate/_validate.py similarity index 100% rename from IPython/external/validate.py rename to IPython/external/validate/_validate.py diff --git a/setupbase.py b/setupbase.py index 946f573..ec723a1 100644 --- a/setupbase.py +++ b/setupbase.py @@ -108,6 +108,18 @@ def find_packages(): add_package(packages, 'deathrow', tests=True) add_package(packages, 'extensions') add_package(packages, 'external') + add_package(packages, 'external.argparse') + add_package(packages, 'external.configobj') + add_package(packages, 'external.decorator') + add_package(packages, 'external.decorators') + add_package(packages, 'external.guid') + add_package(packages, 'external.Itpl') + add_package(packages, 'external.mglob') + add_package(packages, 'external.path') + add_package(packages, 'external.pretty') + add_package(packages, 'external.pyparsing') + add_package(packages, 'external.simplegeneric') + add_package(packages, 'external.validate') add_package(packages, 'frontend') add_package(packages, 'frontend.qt') add_package(packages, 'frontend.qt.console', tests=True)