Changeset a7b14a6


Ignore:
Timestamp:
Feb 1, 2017, 10:54:35 PM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
yinfft+
Children:
09558b8
Parents:
b4eadf0 (diff), f131ba8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into yinfft+

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/lib/moresetuptools.py

    rb4eadf0 ra7b14a6  
    44import distutils, distutils.command.clean, distutils.dir_util
    55from .gen_external import generate_external, header, output_path
     6
     7def 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
     38def get_aubio_pyversion():
     39    # convert to version for python according to pep 440
     40    # see https://www.python.org/dev/peps/pep-0440/
     41    verstr = get_aubio_version()
     42    if '~alpha' in verstr:
     43        verstr = verstr.split('~')[0] + 'a1'
     44    # TODO: add rc, .dev, and .post suffixes, add numbering
     45    return verstr
    646
    747# inspired from https://gist.github.com/abergmeier/9488990
     
    80120               ]
    81121    # samplerate only works with float
    82     if usedouble == False:
     122    if usedouble is False:
    83123        packages += ['samplerate']
    84124    else:
     
    120160def add_system_aubio(ext):
    121161    # use pkg-config to find aubio's location
    122     add_packages(['aubio'], ext)
     162    aubio_version = get_aubio_version()
     163    add_packages(['aubio = ' + aubio_version], ext)
    123164    if 'aubio' not in ext.libraries:
    124         print("Error: libaubio not found")
     165        print("Info: aubio " + aubio_version + " was not found by pkg-config")
     166    else:
     167        print("Info: using system aubio " + aubio_version + " found in " + ' '.join(ext.library_dirs))
    125168
    126169class CleanGenerated(distutils.command.clean.clean):
  • setup.py

    rb4eadf0 ra7b14a6  
    77from python.lib.gen_external import generate_external, header, output_path
    88
    9 # read from VERSION
    10 for l in open('VERSION').readlines(): exec (l.strip())
    11 
    12 if AUBIO_MAJOR_VERSION is None or AUBIO_MINOR_VERSION is None \
    13         or AUBIO_PATCH_VERSION is None:
    14     raise SystemError("Failed parsing VERSION file.")
    15 
    16 __version__ = '.'.join(map(str, [AUBIO_MAJOR_VERSION,
    17                                  AUBIO_MINOR_VERSION,
    18                                  AUBIO_PATCH_VERSION]))
    19 if AUBIO_VERSION_STATUS is not None:
    20     if AUBIO_VERSION_STATUS.startswith('~'):
    21         AUBIO_VERSION_STATUS = AUBIO_VERSION_STATUS[1:]
    22     #__version__ += AUBIO_VERSION_STATUS
     9__version__ = get_aubio_pyversion()
    2310
    2411include_dirs = []
Note: See TracChangeset for help on using the changeset viewer.