Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
fix: standardise version number placement (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
UsamaSadiq authored Oct 25, 2022
1 parent 3e7d761 commit 4ea9f1c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ecommerce_worker/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""init"""

__version__ = '3.3.2'
21 changes: 20 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import os
import re

from setuptools import setup, find_packages


Expand Down Expand Up @@ -33,10 +36,26 @@ def is_requirement(line):
line.startswith('git+')
)

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"""(^__version__\s?=\s?['"](?P<version_number>[^'"]*)['"])""",
version_file, re.M)
if version_match:
return version_match.group('version_number')
raise RuntimeError('Unable to find version string.')


VERSION = get_version("ecommerce_worker/__init__.py")


setup(
name='edx-ecommerce-worker',
version='3.3.2',
version=VERSION,
description='Celery tasks supporting the operations of edX\'s ecommerce service',
long_description=long_description,
classifiers=[
Expand Down

0 comments on commit 4ea9f1c

Please sign in to comment.