diff options
| author | Reece Hart <reecehart@gmail.com> | 2017-04-10 15:14:41 -0700 |
|---|---|---|
| committer | Val Neekman <un33kvu@gmail.com> | 2017-04-10 18:14:41 -0400 |
| commit | d6a233b5c4446d8510288489ce012675e91089c2 (patch) | |
| tree | f56fb1f7910d8521f7b57d5f2ba4b62f63b68a7e /setup.py | |
| parent | ea5e26af19b3e99ef47c3b802fddb87b03fa3fae (diff) | |
| download | python-slugify-d6a233b5c4446d8510288489ce012675e91089c2.tar.gz | |
#38: use find_packages() rather than home-grown get_packages and get_package_data (#39)
Diffstat (limited to 'setup.py')
| -rwxr-xr-x | setup.py | 30 |
1 files changed, 2 insertions, 28 deletions
@@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from setuptools import setup +from setuptools import setup, find_packages import re import os import sys @@ -41,31 +41,6 @@ def get_version(package): return re.search("^__version__ = ['\"]([^'\"]+)['\"]", init_py, re.MULTILINE).group(1) -def get_packages(package): - """ - Return root package and all sub-packages. - """ - return [dirpath - for dirpath, dirnames, filenames in os.walk(package) - if os.path.exists(os.path.join(dirpath, '__init__.py'))] - - -def get_package_data(package): - """ - Return all files under the root package, that are not in a - package themselves. - """ - walk = [(dirpath.replace(package + os.sep, '', 1), filenames) - for dirpath, dirnames, filenames in os.walk(package) - if not os.path.exists(os.path.join(dirpath, '__init__.py'))] - - filepaths = [] - for base, filenames in walk: - filepaths.extend([os.path.join(base, filename) - for filename in filenames]) - return {package: filepaths} - - if sys.argv[-1] == 'publish': os.system("python setup.py sdist upload") args = {'version': get_version(package)} @@ -82,8 +57,7 @@ setup( description=description, author=author, author_email=author_email, - packages=get_packages(package), - package_data=get_package_data(package), + packages=find_packages(), install_requires=install_requires, classifiers=classifiers, entry_points={'console_scripts': ['slugify=slugify.slugify:main']}, |
