Skip to content

Commit abeafa7

Browse files
committed
alternative approach used in python requests package
1 parent d536d79 commit abeafa7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

setup.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
# -*- coding: utf-8 -*-
22
from setuptools import setup
3+
import re
34

4-
from pusher.version import VERSION
5+
# Lovingly adapted from https://github.com/kennethreitz/requests/blob/39d693548892057adad703fda630f925e61ee557/setup.py#L50-L55
6+
with open('pusher/version.py', 'r') as fd:
7+
VERSION = re.search(r'^VERSION = [\']([^\']*)[\']',
8+
fd.read(), re.MULTILINE).group(1)
9+
10+
if not VERSION:
11+
raise RuntimeError('Ensure `VERSION` is correctly set in ./pusher/version.py')
512

613
setup(
714
name='pusher',

0 commit comments

Comments
 (0)