Skip to content

Commit

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

Standardize version number placement
  • Loading branch information
aht007 authored Nov 17, 2021
2 parents 4b93c31 + ed8649f commit 7f35556
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions acid/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .acid import AcidBlock, AcidParentBlock, AcidAside

__version__ = '0.2.1'
16 changes: 15 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ def add_version_constraint_or_raise(current_line, current_requirements, add_if_n
return constrained_requirements


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


VERSION = get_version("acid/__init__.py")
README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()


Expand All @@ -88,7 +102,7 @@ def is_requirement(line):

setup(
name='acid-xblock',
version='0.2.1',
version=VERSION,
description='Acid XBlock Test',
long_description=README,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit 7f35556

Please sign in to comment.