From 5d607014457822731b2da90828b91644f7b65617 Mon Sep 17 00:00:00 2001 From: Clinton Blackburn Date: Mon, 30 Aug 2021 21:04:39 -0700 Subject: [PATCH] Setting version manually --- setup.py | 21 +++++++++++++++++---- sortedm2m/__init__.py | 8 +------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index cfb4263..2ae5a3f 100755 --- a/setup.py +++ b/setup.py @@ -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[^'\"]+)['\"]", + 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='gregor@muellegger.de', diff --git a/sortedm2m/__init__.py b/sortedm2m/__init__.py index 08674dc..7f5601d 100644 --- a/sortedm2m/__init__.py +++ b/sortedm2m/__init__.py @@ -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'