Skip to content

Commit

Permalink
Merge pull request #134 from edx/aht/BOM-3038-STANDARDIZE-VERSION-NUMBER
Browse files Browse the repository at this point in the history
Standardize version number placement
  • Loading branch information
aht007 committed Nov 16, 2021
2 parents 2978a97 + 77af0b5 commit 511e040
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions eventtracking/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
"""A simple event tracking library"""

__version__ = '1.1.4'
20 changes: 19 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"""

import os
import re

from setuptools import setup
from setuptools import find_packages

Expand Down Expand Up @@ -43,13 +45,29 @@ def load_requirements(*requirements_paths):
return list(requirements)


def get_version(*file_paths):
"""
Extract the version string from the file at the given relative path fragments.
"""
filename = os.path.join(os.path.dirname(__file__), *file_paths)
with open(filename, encoding='utf-8') as opened_file:
version_file = opened_file.read()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError('Unable to find version string.')


VERSION = get_version("eventtracking", "__init__.py")
README = open(os.path.join(os.path.dirname(__file__), 'README.rst'),
encoding='utf-8').read()
REQUIREMENTS = load_requirements('requirements/base.in')


setup(
name='event-tracking',
version='1.1.4',
version=VERSION,
packages=find_packages(),
include_package_data=True,
license='AGPLv3 License',
Expand Down

0 comments on commit 511e040

Please sign in to comment.