| 1 |
|
| 2 |
import codecs |
| 3 |
import os |
| 4 |
import re |
| 5 |
|
| 6 |
from setuptools import setup |
| 7 |
|
| 8 |
|
| 9 |
def get_version(package): |
| 10 |
""" |
| 11 |
Return package version as listed in `__version__` in `init.py`. |
| 12 |
""" |
| 13 |
matches = re.search( |
| 14 |
r"__version__[\s]+=[\s]+['\"](?P<version>[^'\"]+)['\"]", |
| 15 |
open(os.path.join(package, '__init__.py')).read(), |
| 16 |
re.M |
| 17 |
) |
| 18 |
|
| 19 |
return matches.group(1) if matches else None |
| 20 |
|
| 21 |
|
| 22 |
def read(filename): |
| 23 |
return codecs.open(os.path.join(os.path.dirname(__file__), filename), |
| 24 |
encoding='utf8').read() |
| 25 |
|
| 26 |
|
| 27 |
long_description = '\n\n'.join(( |
| 28 |
read('README.rst'), |
| 29 |
read('CHANGES.rst'), |
| 30 |
)) |
| 31 |
|
| 32 |
setup( |
| 33 |
name='django-sortedm2m', |
| 34 |
version=get_version('sortedm2m'), |
| 35 |
url='https://github.com/jazzband/django-sortedm2m', |
| 36 |
license='BSD', |
| 37 |
description="Drop-in replacement for Django's many to many field with sorted relations.", |
| 38 |
long_description=long_description, |
| 39 |
author=u'Gregor Müllegger', |
| 40 |
author_email='[email protected]', |
| 41 |
packages=['sortedm2m'], |
| 42 |
include_package_data=True, |
| 43 |
zip_safe=False, |
| 44 |
classifiers=[ |
| 45 |
'Development Status :: 5 - Production/Stable', |
| 46 |
'Environment :: Web Environment', |
| 47 |
'Framework :: Django', |
| 48 |
'Framework :: Django :: 2.2', |
| 49 |
'Framework :: Django :: 3.0', |
| 50 |
'Framework :: Django :: 3.1', |
| 51 |
'Framework :: Django :: 3.2', |
| 52 |
'Intended Audience :: Developers', |
| 53 |
'License :: OSI Approved :: BSD License', |
| 54 |
'Natural Language :: English', |
| 55 |
'Operating System :: OS Independent', |
| 56 |
'Programming Language :: Python', |
| 57 |
'Programming Language :: Python :: 3.6', |
| 58 |
'Programming Language :: Python :: 3.7', |
| 59 |
'Programming Language :: Python :: 3.8', |
| 60 |
'Programming Language :: Python :: 3.9', |
| 61 |
], |
| 62 |
) |