diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-04-28 15:01:26 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-04-28 15:01:26 -0400 |
commit | a5c9907d40b4846175106c098bc0aef9801c786b (patch) | |
tree | e1ffc6960a99ad7d91f6148a6a8254fa9caa2896 /setup.py | |
parent | fc624dcfa40bf765bbfffa2fd964f73422e4dbe8 (diff) | |
download | sqlalchemy-a5c9907d40b4846175106c098bc0aef9801c786b.tar.gz |
don't need 2to3
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 72 |
1 files changed, 20 insertions, 52 deletions
@@ -17,26 +17,16 @@ except ImportError: has_setuptools = False from distutils.core import setup, Extension Feature = None - try: # Python 3 - from distutils.command.build_py import build_py_2to3 as build_py - except ImportError: # Python 2 - from distutils.command.build_py import build_py cmdclass = {} pypy = hasattr(sys, 'pypy_version_info') jython = sys.platform.startswith('java') py3k = False extra = {} -if sys.version_info < (2, 4): - raise Exception("SQLAlchemy requires Python 2.4 or higher.") +if sys.version_info < (2, 6): + raise Exception("SQLAlchemy requires Python 2.6 or higher.") elif sys.version_info >= (3, 0): py3k = True - if has_setuptools: - extra.update( - use_2to3=True, - ) - else: - cmdclass['build_py'] = build_py ext_modules = [ Extension('sqlalchemy.cprocessors', @@ -48,7 +38,7 @@ ext_modules = [ ] ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError) -if sys.platform == 'win32' and sys.version_info > (2, 6): +if sys.platform == 'win32': # 2.6's distutils.msvc9compiler can raise an IOError when failing to # find the compiler ext_errors += (IOError,) @@ -90,8 +80,7 @@ def find_packages(location): packages = [] for pkg in ['sqlalchemy']: for _dir, subdirectories, files in ( - os.walk(os.path.join(location, pkg)) - ): + os.walk(os.path.join(location, pkg))): if '__init__.py' in files: tokens = _dir.split(os.sep)[len(location.split(os.sep)):] packages.append(".".join(tokens)) @@ -121,20 +110,20 @@ def run_setup(with_cext): kwargs['ext_modules'] = ext_modules setup(name="SQLAlchemy", - version=VERSION, - description="Database Abstraction Library", - author="Mike Bayer", - author_email="mike_mp@zzzcomputing.com", - url="http://www.sqlalchemy.org", - packages=find_packages('lib'), - package_dir={'': 'lib'}, - license="MIT License", - cmdclass=cmdclass, - - tests_require=['nose >= 0.11'], - test_suite="sqla_nose", - long_description=readme, - classifiers=[ + version=VERSION, + description="Database Abstraction Library", + author="Mike Bayer", + author_email="mike_mp@zzzcomputing.com", + url="http://www.sqlalchemy.org", + packages=find_packages('lib'), + package_dir={'': 'lib'}, + license="MIT License", + cmdclass=cmdclass, + + tests_require=['nose >= 0.11'], + test_suite="sqla_nose", + long_description=readme, + classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", @@ -149,28 +138,8 @@ def run_setup(with_cext): **kwargs ) -def monkeypatch2to3(): - from sa2to3 import refactor_string - from lib2to3.refactor import RefactoringTool - RefactoringTool.old_refactor_string = RefactoringTool.refactor_string - RefactoringTool.refactor_string = refactor_string - -def unmonkeypatch2to3(): - from lib2to3.refactor import RefactoringTool - if hasattr(RefactoringTool, 'old_refactor_string'): - RefactoringTool.refactor_string = RefactoringTool.old_refactor_string - if pypy or jython or py3k: - if py3k: - # monkeypatch our preprocessor onto the 2to3 tool. - monkeypatch2to3() - try: - run_setup(False) - finally: - if py3k: - # unmonkeypatch to not stomp other setup.py's that are compiled - # and exec'd and which also require 2to3 fixing - unmonkeypatch2to3() + run_setup(False) status_msgs( "WARNING: C extensions are not supported on " + "this Python platform, speedups are not enabled.", @@ -179,8 +148,7 @@ if pypy or jython or py3k: else: try: run_setup(True) - except BuildFailed: - exc = sys.exc_info()[1] # work around py 2/3 different syntax + except BuildFailed as exc: status_msgs( exc.cause, "WARNING: The C extension could not be compiled, " + |