-
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
18 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
#!/usr/bin/env python | ||
import codecs | ||
import os | ||
import re | ||
|
||
from setuptools import setup | ||
|
||
|
||
def get_version(package): | ||
""" | ||
Return package version as listed in `__version__` in `init.py`. | ||
""" | ||
matches = re.search( | ||
r"__version__[\s]+=[\s]+['\"](?P<version>[^'\"]+)['\"]", | ||
open(os.path.join(package, '__init__.py')).read(), | ||
re.M | ||
) | ||
|
||
return matches.group(1) if matches else None | ||
|
||
|
||
def read(filename): | ||
return codecs.open(os.path.join(os.path.dirname(__file__), filename), | ||
encoding='utf8').read() | ||
|
@@ -17,11 +31,10 @@ def read(filename): | |
|
||
setup( | ||
name='django-sortedm2m', | ||
use_scm_version={"version_scheme": "post-release"}, | ||
setup_requires=["setuptools_scm"], | ||
url='http://github.com/jazzband/django-sortedm2m', | ||
version=get_version('sortedm2m'), | ||
url='https://github.com/jazzband/django-sortedm2m', | ||
license='BSD', | ||
description="Drop-in replacement for django's many to many field with sorted relations.", | ||
description="Drop-in replacement for Django's many to many field with sorted relations.", | ||
long_description=long_description, | ||
author=u'Gregor Müllegger', | ||
author_email='[email protected]', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1 @@ | ||
from pkg_resources import get_distribution, DistributionNotFound | ||
|
||
try: | ||
__version__ = get_distribution("django-sortedm2m").version | ||
except DistributionNotFound: | ||
# package is not installed | ||
__version__ = None | ||
__version__ = '3.1.0' |