Skip to content

Commit 668517e

Browse files
authoredNov 17, 2021
Merge pull request #213 from edx/aht/BOM-STANDARDIZE-VERSION-NUMBER-PLACEMENT
Standardize version number placement
2 parents 1e46c7e + ddbcf75 commit 668517e

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed
 

‎.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Python CI
22
on:
33
push:
44
branches:

‎setup.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import os
44
import os.path
5+
import re
56

67
from setuptools import setup
78

@@ -49,6 +50,21 @@ def load_requirements(*requirements_paths):
4950
return list(requirements)
5051

5152

53+
def get_version(*file_paths):
54+
"""
55+
Extract the version string from the file at the given relative path fragments.
56+
"""
57+
filename = os.path.join(os.path.dirname(__file__), *file_paths)
58+
with open(filename, encoding='utf-8') as opened_file:
59+
version_file = opened_file.read()
60+
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
61+
version_file, re.M)
62+
if version_match:
63+
return version_match.group(1)
64+
raise RuntimeError('Unable to find version string.')
65+
66+
67+
VERSION = get_version("workbench", "__init__.py")
5268
package_data = {} # pylint: disable=invalid-name
5369
package_data.update(find_package_data("sample_xblocks.basic", ["public", "templates"]))
5470
package_data.update(find_package_data("sample_xblocks.thumbs", ["static"]))
@@ -57,7 +73,7 @@ def load_requirements(*requirements_paths):
5773

5874
setup(
5975
name='xblock-sdk',
60-
version='0.4.0',
76+
version=VERSION,
6177
description='XBlock SDK',
6278
packages=[
6379
'sample_xblocks',

‎workbench/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
"""
22
Provide a djangoapp for XBlock development
33
"""
4+
5+
__version__ = '0.4.0'

0 commit comments

Comments
 (0)
Please sign in to comment.