]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- we can again use setuptools.find_packages since we require setuptools
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 13 Aug 2015 18:48:18 +0000 (14:48 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 13 Aug 2015 18:48:18 +0000 (14:48 -0400)
- clean up other things we aren't using anymore

setup.py

index 2685d4c6e96c4ecf1114c30873ad146733c430fd..8f9ba4dd8549cd7cd0e6851a2d831211a029e8c4 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -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