diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-08-13 14:48:18 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-08-13 14:48:18 -0400 |
commit | 44420423de34c54486c0210076c233e5b9f57ee2 (patch) | |
tree | 0cf2c595ef5ae15ff4437ceda04ac38938b92b30 | |
parent | 88749550f6b973efaa09b9571176dbb65c45574d (diff) | |
download | sqlalchemy-44420423de34c54486c0210076c233e5b9f57ee2.tar.gz |
- we can again use setuptools.find_packages since we require setuptools
- clean up other things we aren't using anymore
-rw-r--r-- | setup.py | 38 |
1 files changed, 13 insertions, 25 deletions
@@ -8,16 +8,12 @@ from distutils.errors import DistutilsExecError from distutils.errors import DistutilsPlatformError from setuptools import Extension from setuptools import setup +from setuptools import find_packages from setuptools.command.test import test as TestCommand -py3k = False - cmdclass = {} -extra = {} if sys.version_info < (2, 6): raise Exception("SQLAlchemy requires Python 2.6 or higher.") -elif sys.version_info >= (3, 0): - py3k = True cpython = platform.python_implementation() == 'CPython' @@ -67,7 +63,8 @@ cmdclass['build_ext'] = ve_build_ext class PyTest(TestCommand): - # from https://pytest.org/latest/goodpractises.html#integration-with-setuptools-test-commands + # from https://pytest.org/latest/goodpractises.html\ + # #integration-with-setuptools-test-commands user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] default_options = ["-n", "4", "-q"] @@ -98,29 +95,20 @@ def status_msgs(*msgs): print('*' * 75) -def find_packages(location): - packages = [] - for pkg in ['sqlalchemy']: - for _dir, subdirectories, files in ( - 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)) - return packages - -v_file = open(os.path.join(os.path.dirname(__file__), - 'lib', 'sqlalchemy', '__init__.py')) -VERSION = re.compile(r".*__version__ = '(.*?)'", - re.S).match(v_file.read()).group(1) -v_file.close() +with open( + os.path.join( + os.path.dirname(__file__), + 'lib', 'sqlalchemy', '__init__.py')) as v_file: + VERSION = re.compile( + r".*__version__ = '(.*?)'", + re.S).match(v_file.read()).group(1) -r_file = open(os.path.join(os.path.dirname(__file__), 'README.rst')) -readme = r_file.read() -r_file.close() +with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as r_file: + readme = r_file.read() def run_setup(with_cext): - kwargs = extra.copy() + kwargs = {} if with_cext: kwargs['ext_modules'] = ext_modules |