Skip to content

Commit

Permalink
Merge pull request #330 from edx/aht/BOM-STANDARDIZE-VERSION-NUMBER-P…
Browse files Browse the repository at this point in the history
…LACEMENT

Standardize version number placement
  • Loading branch information
aht007 authored Nov 12, 2021
2 parents f8e14eb + 8e776a9 commit 7b6c052
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions edxval/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""
init
"""

__version__ = '2.1.1'
17 changes: 16 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


import os
import re
import sys

from setuptools import setup
Expand Down Expand Up @@ -47,7 +48,21 @@ def load_requirements(*requirements_paths):
return list(requirements)


VERSION = '2.1.1'
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("edxval", "__init__.py")

if sys.argv[-1] == 'tag':
print("Tagging the version on github:")
Expand Down

0 comments on commit 7b6c052

Please sign in to comment.