Get version from __init__.py
diff --git a/setup.py b/setup.py index 062a2e1..9bf9b0e 100755 --- a/setup.py +++ b/setup.py
@@ -1,12 +1,20 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- - +import re import os import sys from setuptools import setup -VERSION = '2015.04.28' +version_regex = r'__version__ = ["\']([^"\']*)["\']' +with open('certifi/__init__.py', 'r') as f: + text = f.read() + match = re.search(version_regex, text) + + if match: + VERSION = match.group(1) + else: + raise RuntimeError("No version number found!") if sys.argv[-1] == 'publish': os.system('python setup.py sdist bdist_wheel upload')