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 #16

Merged
merged 1 commit into from
Nov 9, 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
22 changes: 21 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


Expand All @@ -24,14 +27,31 @@ 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("tincan", "__init__.py")


setup(
name='edx-tincan-py35',
packages=[
'tincan',
'tincan/conversions',
'tincan/documents',
],
version='1.0.0',
version=VERSION,
description='A Python 3 library for implementing Tin Can API.',
author='edX',
author_email='oscm@edx.org',
Expand Down
2 changes: 2 additions & 0 deletions tincan/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@
from .typed_list import TypedList
from .verb import Verb
from .version import Version

__version__ = '1.0.0'