From d6a233b5c4446d8510288489ce012675e91089c2 Mon Sep 17 00:00:00 2001 From: Reece Hart Date: Mon, 10 Apr 2017 15:14:41 -0700 Subject: #38: use find_packages() rather than home-grown get_packages and get_package_data (#39) --- setup.py | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index f944f42..cc93cc9 100755 --- a/setup.py +++ b/setup.py @@ -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']}, -- cgit v1.2.1