History

python/lib/moresetuptools.py: add get_aubio_version and get_aubio_pyversion

Paul Brossier committed 9 years ago

Commit f432bb11 parent 8f0db972 files · +38 −14Browse files

Showing the changes to python (1 of 2 files). Show all

Unified · Split

python/lib/moresetuptools.py+37−0
@@ -4,6 +4,43 @@ import sys, os, glob, subprocess · 3 unmodified lines
44 import distutils, distutils.command.clean, distutils.dir_util
55 from .gen_external import generate_external, header, output_path
66
7+def get_aubio_version():
8+ # read from VERSION
9+ this_file_dir = os.path.dirname(os.path.abspath(__file__))
10+ version_file = os.path.join(this_file_dir, '..', '..', 'VERSION')
11+
12+ if not os.path.isfile(version_file):
13+ raise SystemError("VERSION file not found.")
14+
15+ for l in open(version_file).readlines():
16+ #exec (l.strip())
17+ if l.startswith('AUBIO_MAJOR_VERSION'):
18+ AUBIO_MAJOR_VERSION = int(l.split('=')[1])
19+ if l.startswith('AUBIO_MINOR_VERSION'):
20+ AUBIO_MINOR_VERSION = int(l.split('=')[1])
21+ if l.startswith('AUBIO_PATCH_VERSION'):
22+ AUBIO_PATCH_VERSION = int(l.split('=')[1])
23+ if l.startswith('AUBIO_VERSION_STATUS'):
24+ AUBIO_VERSION_STATUS = l.split('=')[1].strip()[1:-1]
25+
26+ if AUBIO_MAJOR_VERSION is None or AUBIO_MINOR_VERSION is None \
27+ or AUBIO_PATCH_VERSION is None:
28+ raise SystemError("Failed parsing VERSION file.")
29+
30+ verstr = '.'.join(map(str, [AUBIO_MAJOR_VERSION,
31+ AUBIO_MINOR_VERSION,
32+ AUBIO_PATCH_VERSION]))
33+
34+ if AUBIO_VERSION_STATUS is not None:
35+ verstr += AUBIO_VERSION_STATUS
36+ return verstr
37+
38+def get_aubio_pyversion():
39+ verstr = get_aubio_version()
40+ if '~alpha' in verstr:
41+ verstr = verstr.split('~')[0] + 'a1'
42+ return verstr
43+
744 # inspired from https://gist.github.com/abergmeier/9488990
845 def add_packages(packages, ext=None, **kw):
946 """ use pkg-config to search which of 'packages' are installed """

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t