Skip to content

Commit

Permalink
Setting version manually
Browse files Browse the repository at this point in the history
  • Loading branch information
clintonb committed Aug 31, 2021
1 parent 1ac1801 commit 5d60701
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
21 changes: 17 additions & 4 deletions setup.py
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()
Expand All @@ -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]',
Expand Down
8 changes: 1 addition & 7 deletions sortedm2m/__init__.py
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'

0 comments on commit 5d60701

Please sign in to comment.