Skip to content

Commit abb53e4

Browse files
committed
Get version from __init__.py
1 parent eb82735 commit abb53e4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

setup.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
3-
3+
import re
44
import os
55
import sys
66

77
from setuptools import setup
88

9-
VERSION = '2015.04.28'
9+
version_regex = r'__version__ = ["\']([^"\']*)["\']'
10+
with open('certifi/__init__.py', 'r') as f:
11+
text = f.read()
12+
match = re.search(version_regex, text)
13+
14+
if match:
15+
VERSION = match.group(1)
16+
else:
17+
raise RuntimeError("No version number found!")
1018

1119
if sys.argv[-1] == 'publish':
1220
os.system('python setup.py sdist bdist_wheel upload')

0 commit comments

Comments
 (0)