We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8178aa3 commit 5c47cebCopy full SHA for 5c47ceb
setup.py
@@ -1,10 +1,24 @@
1
from setuptools import setup, Extension
2
+import re
3
+
4
+def get_version():
5
+ """
6
+ Extract the version number from arraydeque.c.
7
+ Looks for a line of the form:
8
+ #define ARRAYDEQUE_VERSION "0.1.0"
9
10
+ with open("arraydeque.c", "r", encoding="utf-8") as f:
11
+ content = f.read()
12
+ match = re.search(r'#define\s+ARRAYDEQUE_VERSION\s+"([^"]+)"', content)
13
+ if match:
14
+ return match.group(1)
15
+ raise RuntimeError("Unable to find version string in arraydeque.c.")
16
17
module = Extension('arraydeque', sources=['arraydeque.c'])
18
19
setup(
20
name='arraydeque',
- version='0.1',
21
+ version=get_version(),
22
description='Array-backed deque implementation',
23
ext_modules=[module],
24
)
0 commit comments