|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +import os |
| 3 | +from setuptools import setup |
| 4 | + |
| 5 | + |
| 6 | +def read(fname): |
| 7 | + """ Return file content. """ |
| 8 | + |
| 9 | + return open( |
| 10 | + os.path.join( |
| 11 | + os.path.dirname(__file__), fname) |
| 12 | + ).read() |
| 13 | + |
| 14 | + |
| 15 | +def get_packages(package): |
| 16 | + """ Return root package and all sub-packages. """ |
| 17 | + |
| 18 | + return [dirpath |
| 19 | + for dirpath, dirnames, filenames in os.walk(package) |
| 20 | + if os.path.exists(os.path.join(dirpath, '__init__.py'))] |
| 21 | + |
| 22 | + |
| 23 | +def get_package_data(package): |
| 24 | + """ |
| 25 | + Return all files under the root package, |
| 26 | + that are not in a package themselves. |
| 27 | + """ |
| 28 | + |
| 29 | + walk = [(dirpath.replace(package + os.sep, '', 1), filenames) |
| 30 | + for dirpath, dirnames, filenames in os.walk(package) |
| 31 | + if not os.path.exists(os.path.join(dirpath, '__init__.py'))] |
| 32 | + |
| 33 | + filepaths = [] |
| 34 | + for base, filenames in walk: |
| 35 | + filepaths.extend([os.path.join(base, filename) |
| 36 | + for filename in filenames]) |
| 37 | + return {package: filepaths} |
| 38 | + |
| 39 | +setup( |
| 40 | + name='simple-settings', |
| 41 | + version='0.2.0', |
| 42 | + install_requires=[], |
| 43 | + url='https://github.com/drgarcia1986/simple-settings', |
| 44 | + author='Diego Garcia', |
| 45 | + author_email='drgarcia1986@gmail.com', |
| 46 | + keywords='django flask bottle tornado settings configuration conf', |
| 47 | + description='A simple way to manage your project settings', |
| 48 | + long_description=read('README.md'), |
| 49 | + packages=get_packages('simple_settings'), |
| 50 | + packages_data=get_package_data('simple_settings'), |
| 51 | + classifiers=[ |
| 52 | + 'Intended Audience :: Developers', |
| 53 | + 'License :: OSI Approved :: MIT License', |
| 54 | + 'Operating System :: OS Independent', |
| 55 | + 'Programming Language :: Python :: 2', |
| 56 | + 'Programming Language :: Python :: 3', |
| 57 | + ] |
| 58 | +) |
0 commit comments