File: python-setup.py.patch

package info (click to toggle)
cwiid 0.6.91-12
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,780 kB
  • sloc: ansic: 7,742; python: 259; makefile: 258; lex: 176; yacc: 73; awk: 16
file content (22 lines) | stat: -rw-r--r-- 731 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Index: cwiid/python/setup.py
===================================================================
--- cwiid.orig/python/setup.py
+++ cwiid/python/setup.py
@@ -1,6 +1,16 @@
 from distutils.core import setup, Extension
+from subprocess import PIPE, Popen
+import os, re
+
+changelogFile = os.path.join(os.path.dirname(__file__), "..", "debian", "changelog")
+p=Popen(f"dpkg-parsechangelog -l {changelogFile} | grep Version",
+        shell=True, stdout=PIPE)
+out, err = p.communicate()
+version = out.decode("utf-8").strip()
+m = re.match(r"^[^0-9]*([.0-9]*).*$",version, re.M)
+version = m.group(1)
 
 setup(name='cwiid',
-	version='0.6.00',
+	version=version,
 	ext_modules=[Extension('cwiid', ['cwiidmodule.c', 'Wiimote.c'])]
 	)