Skip to content

Commit

Permalink
Merge pull request #224 from edx/aht/BOM-3039-STANDARDIZE-VERSION-NUMBER
Browse files Browse the repository at this point in the history
Standardize version number placement
  • Loading branch information
aht007 authored Nov 17, 2021
2 parents 583e951 + 504d997 commit 0f96d74
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python
import os
import re

from setuptools import setup, find_packages

import organizations


def load_requirements(*requirements_paths):
"""
Expand All @@ -28,9 +28,26 @@ def is_requirement(line):
return line and not line.startswith(('-r', '#', '-e', 'git+', '-c'))


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("organizations", "__init__.py")


setup(
name='edx-organizations',
version=organizations.__version__,
version=VERSION,
description='Organization management module for Open edX',
long_description=open('README.rst').read(),
author='edX',
Expand Down

0 comments on commit 0f96d74

Please sign in to comment.