Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize version number placement #47

Merged
merged 1 commit into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
17 changes: 16 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Set up for XBlock acid block."""

import os
import re

from setuptools import setup

Expand Down Expand Up @@ -31,6 +32,20 @@ def load_requirements(*requirements_paths):
return list(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 @@ -44,7 +59,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