Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/lib/moresetuptools.py

    rf77820d rc7d444a  
    55from .gen_external import generate_external, header, output_path
    66
    7 from this_version import get_aubio_version
     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
    846
    947# inspired from https://gist.github.com/abergmeier/9488990
     
    75113    # loof for additional packages
    76114    print("Info: looking for *optional* additional packages")
    77     packages = ['libavcodec', 'libavformat', 'libavutil', 'libavresample',
    78                 'jack',
    79                 'jack',
     115    packages = ['libavcodec', 'libavformat', 'libavutil',
     116                'libswresample', 'libavresample',
    80117                'sndfile',
    81118                #'fftw3f',
     
    89126    if 'avcodec' in ext.libraries \
    90127            and 'avformat' in ext.libraries \
    91             and 'avutil' in ext.libraries \
    92             and 'avresample' in ext.libraries:
    93         ext.define_macros += [('HAVE_LIBAV', 1)]
    94     if 'jack' in ext.libraries:
    95         ext.define_macros += [('HAVE_JACK', 1)]
     128            and 'avutil' in ext.libraries:
     129        if 'swresample' in ext.libraries:
     130            ext.define_macros += [('HAVE_SWRESAMPLE', 1)]
     131        elif 'avresample' in ext.libraries:
     132            ext.define_macros += [('HAVE_AVRESAMPLE', 1)]
     133        if 'swresample' in ext.libraries or 'avresample' in ext.libraries:
     134            ext.define_macros += [('HAVE_LIBAV', 1)]
    96135    if 'sndfile' in ext.libraries:
    97136        ext.define_macros += [('HAVE_SNDFILE', 1)]
Note: See TracChangeset for help on using the changeset viewer.