Skip to content

Commit b36a449

Browse files
committed
add version number to package
1 parent 6024b4c commit b36a449

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

obspy_github_api/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# -*- coding: utf-8 -*-
22
from .obspy_github_api import *
3+
4+
__version__ = '0.0.0.dev'

setup.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import inspect
22
import os
3+
import re
34
from setuptools import setup
45

56
INSTALL_REQUIRES = [
@@ -12,6 +13,14 @@
1213
inspect.currentframe())))
1314

1415

16+
# get the package version from from the main __init__ file.
17+
version_regex_pattern = r"__version__ += +(['\"])([^\1]+)\1"
18+
for line in open(os.path.join(SETUP_DIRECTORY, 'obspy_github_api',
19+
'__init__.py')):
20+
if '__version__' in line:
21+
version = re.match(version_regex_pattern, line).group(2)
22+
23+
1524
def find_packages():
1625
"""
1726
Simple function to find all modules under the current folder.
@@ -25,7 +34,7 @@ def find_packages():
2534

2635
setup(
2736
name="obspy_github_api",
28-
version="0.0.0.dev",
37+
version=version,
2938
description="Helper routines to interact with obspy/obspy via GitHub API",
3039
author="Tobias Megies",
3140
author_email="[email protected]",

0 commit comments

Comments
 (0)