Skip to content

Commit c651526

Browse files
committed
Simplify a lot the setup script using setuptools
1 parent cc8a829 commit c651526

File tree

1 file changed

+25
-58
lines changed

1 file changed

+25
-58
lines changed

setup.py

Lines changed: 25 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,75 +2,42 @@
22
Based entirely on Django's own ``setup.py``.
33
"""
44
from setuptools import setup
5-
6-
import os
7-
from distutils.command.install import INSTALL_SCHEMES
5+
from setuptools import find_packages
86

97
import tagging
108

11-
12-
def fullsplit(path, result=None):
13-
"""
14-
Split a pathname into components (the opposite of os.path.join) in a
15-
platform-neutral way.
16-
"""
17-
if result is None:
18-
result = []
19-
head, tail = os.path.split(path)
20-
if head == '':
21-
return [tail] + result
22-
if head == path:
23-
return result
24-
return fullsplit(head, [tail] + result)
25-
26-
# Tell distutils to put the data_files in platform-specific installation
27-
# locations. See here for an explanation:
28-
# http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
29-
for scheme in INSTALL_SCHEMES.values():
30-
scheme['data'] = scheme['purelib']
31-
32-
# Compile the list of packages available, because distutils doesn't have
33-
# an easy way to do this.
34-
packages, data_files = [], []
35-
root_dir = os.path.dirname(__file__)
36-
tagging_dir = os.path.join(root_dir, 'tagging')
37-
pieces = fullsplit(root_dir)
38-
if pieces[-1] == '':
39-
len_root_dir = len(pieces) - 1
40-
else:
41-
len_root_dir = len(pieces)
42-
43-
for dirpath, dirnames, filenames in os.walk(tagging_dir):
44-
# Ignore dirnames that start with '.'
45-
for i, dirname in enumerate(dirnames):
46-
if dirname.startswith('.'): del dirnames[i]
47-
if '__init__.py' in filenames:
48-
packages.append('.'.join(fullsplit(dirpath)[len_root_dir:]))
49-
elif filenames:
50-
data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
51-
529
setup(
53-
name = 'django-tagging',
54-
version = tagging.__version__,
55-
description = 'Generic tagging application for Django',
56-
author = 'Jonathan Buchanan',
57-
author_email = '[email protected]',
58-
url = 'https://github.com/Fantomas42/django-tagging',
59-
packages = packages,
60-
data_files = data_files,
61-
classifiers = [
62-
'Development Status :: 4 - Beta',
63-
'Environment :: Web Environment',
10+
name='django-tagging',
11+
version=tagging.__version__,
12+
13+
description='Generic tagging application for Django',
14+
long_description='\n'.join([open('README.rst').read(),
15+
open('CHANGELOG.txt').read()]),
16+
keywords='django, tag, tagging',
17+
18+
author=tagging.__author__,
19+
author_email=tagging.__author_email__,
20+
maintainer=tagging.__maintainer__,
21+
maintainer_email=tagging.__maintainer_email__,
22+
url=tagging.__url__,
23+
license=tagging.__license__,
24+
25+
packages=find_packages(),
26+
include_package_data=True,
27+
zip_safe=False,
28+
29+
classifiers=[
6430
'Framework :: Django',
31+
'Environment :: Web Environment',
32+
'Operating System :: OS Independent',
33+
'Development Status :: 5 - Production/Stable',
6534
'Intended Audience :: Developers',
6635
'License :: OSI Approved :: BSD License',
67-
'Operating System :: OS Independent',
6836
'Programming Language :: Python',
6937
'Programming Language :: Python :: 2',
7038
'Programming Language :: Python :: 2.6',
7139
'Programming Language :: Python :: 2.7',
7240
'Programming Language :: Python :: 3',
73-
'Programming Language :: Python :: 3.3',
7441
'Topic :: Utilities',
75-
],
42+
'Topic :: Software Development :: Libraries :: Python Modules']
7643
)

0 commit comments

Comments
 (0)