Skip to content

Commit

Permalink
Merge pull request #117 from aht007/aht/BOM-STANDARDIZE-VERSION-NUMBE…
Browse files Browse the repository at this point in the history
…R-PLACEMENT

Standardize version number placement
  • Loading branch information
aht007 authored Nov 9, 2021
2 parents 4f880a4 + 5b7bb71 commit aa82f53
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 2 additions & 0 deletions edxsearch/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
""" Container module for testing / demoing search """

__version__ = '3.1.0'
23 changes: 21 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python
""" Setup to allow pip installs of edx-search module """
import os
import re

from setuptools import setup

Expand Down Expand Up @@ -29,9 +31,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('edxsearch', '__init__.py')


setup(
name='edx-search',
version='3.1.0',
version=VERSION,
description='Search and index routines for index access',
author='edX',
author_email='[email protected]',
Expand All @@ -52,6 +71,6 @@ def is_requirement(line):
'Framework :: Django :: 3.1',
'Framework :: Django :: 3.2',
],
packages=['search', 'search.tests'],
packages=['search', 'search.tests', 'edxsearch'],
install_requires=load_requirements('requirements/base.in')
)

0 comments on commit aa82f53

Please sign in to comment.