Cleanup setup.py
- Read requirements from requirements.txt - Support both setuptools and distutils - Use wrapper for opening the correct file for requirements.txt and the readme - Import version from package - Hardcode package list - Avoid reading in entire license file when specifying the license attribute
Showing
1 changed file
with
18 additions
and
14 deletions
1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python |
2 | 2 | ||
3 | -from setuptools import setup, find_packages | 3 | +from kappa import __version__ |
4 | - | ||
5 | import os | 4 | import os |
6 | 5 | ||
7 | -requires = [ | 6 | +try: |
8 | - 'boto3>=1.2.2', | 7 | + from setuptools import setup |
9 | - 'placebo>=0.4.1', | 8 | +except ImportError: |
10 | - 'click>=5.0', | 9 | + from distutils.core import setup |
11 | - 'PyYAML>=3.11' | 10 | + |
12 | -] | 11 | + |
12 | +def open_file(fname): | ||
13 | + return open(os.path.join(os.path.dirname(__file__), fname)) | ||
13 | 14 | ||
14 | 15 | ||
15 | setup( | 16 | setup( |
16 | name='kappa', | 17 | name='kappa', |
17 | - version=open(os.path.join('kappa', '_version')).read().strip(), | 18 | + version=__version__, |
18 | description='A CLI tool for AWS Lambda developers', | 19 | description='A CLI tool for AWS Lambda developers', |
19 | - long_description=open('README.rst').read(), | 20 | + long_description=open_file('README.rst').read(), |
21 | + url='https://github.com/garnaat/kappa', | ||
20 | author='Mitch Garnaat', | 22 | author='Mitch Garnaat', |
21 | author_email='mitch@garnaat.com', | 23 | author_email='mitch@garnaat.com', |
22 | - url='https://github.com/garnaat/kappa', | 24 | + license='Apache License 2.0', |
23 | - packages=find_packages(exclude=['tests*']), | 25 | + packages=['kappa', 'kappa.scripts'], |
24 | package_data={'kappa': ['_version']}, | 26 | package_data={'kappa': ['_version']}, |
25 | package_dir={'kappa': 'kappa'}, | 27 | package_dir={'kappa': 'kappa'}, |
26 | entry_points=""" | 28 | entry_points=""" |
27 | [console_scripts] | 29 | [console_scripts] |
28 | kappa=kappa.scripts.cli:cli | 30 | kappa=kappa.scripts.cli:cli |
29 | """, | 31 | """, |
30 | - install_requires=requires, | 32 | + install_requires=open_file('requirements.txt').readlines(), |
31 | - license=open("LICENSE").read(), | 33 | + test_suite='tests', |
34 | + include_package_data=True, | ||
35 | + zip_safe=True, | ||
32 | classifiers=( | 36 | classifiers=( |
33 | 'Development Status :: 3 - Alpha', | 37 | 'Development Status :: 3 - Alpha', |
34 | 'Intended Audience :: Developers', | 38 | 'Intended Audience :: Developers', | ... | ... |
-
Please register or login to post a comment