|
1 | 1 | #!/usr/bin/env python |
2 | 2 | from setuptools import setup, find_packages |
3 | | -from os.path import dirname, join |
4 | | -import sys, os |
| 3 | +from os import path |
| 4 | +import codecs |
| 5 | +import os |
| 6 | +import re |
| 7 | +import sys |
| 8 | + |
5 | 9 |
|
6 | 10 | # When creating the sdist, make sure the django.mo file also exists: |
7 | 11 | if 'sdist' in sys.argv: |
|
13 | 17 | os.chdir('..') |
14 | 18 |
|
15 | 19 |
|
| 20 | +def read(*parts): |
| 21 | + file_path = path.join(path.dirname(__file__), *parts) |
| 22 | + return codecs.open(file_path, encoding='utf-8').read() |
| 23 | + |
| 24 | + |
| 25 | +def find_version(*parts): |
| 26 | + version_file = read(*parts) |
| 27 | + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M) |
| 28 | + if version_match: |
| 29 | + return str(version_match.group(1)) |
| 30 | + raise RuntimeError("Unable to find version string.") |
| 31 | + |
| 32 | + |
16 | 33 | setup( |
17 | 34 | name='django-polymorphic-tree', |
18 | | - version='0.8.7', |
| 35 | + version=find_version('polymorphic_tree', '__init__.py'), |
19 | 36 | license='Apache License, Version 2.0', |
20 | 37 |
|
21 | 38 | install_requires=[ |
|
27 | 44 | 'Django (>=1.3)', # Using staticfiles |
28 | 45 | ], |
29 | 46 | description="A polymorphic mptt structure to display content in a tree.", |
30 | | - long_description=open(join(dirname(__file__), 'README.rst')).read(), |
| 47 | + long_description=read('README.rst'), |
31 | 48 |
|
32 | 49 | author='Diederik van der Boor', |
33 | 50 | |
|
49 | 66 | 'Programming Language :: Python', |
50 | 67 | 'Programming Language :: Python :: 2.6', |
51 | 68 | 'Programming Language :: Python :: 2.7', |
| 69 | + 'Topic :: Internet :: WWW/HTTP', |
| 70 | + 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', |
| 71 | + 'Topic :: Software Development :: Libraries :: Python Modules', |
52 | 72 | ] |
53 | 73 | ) |
0 commit comments