Changeset 7faef58


Ignore:
Timestamp:
Dec 2, 2016, 3:32:30 AM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, sampler, yinfft+
Children:
bee6e96
Parents:
1b2669a
Message:

python/lib/moresetuptools.py: look first for system library, then for local build, then local sources

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/lib/moresetuptools.py

    r1b2669a r7faef58  
    2222
    2323    for package in packages:
     24        print("checking for {:s}".format(package))
    2425        cmd = ['pkg-config', '--libs', '--cflags', package]
    2526        try:
     
    6263    aubio_sources += sorted(glob.glob(os.path.join('src', '*', '**.c')))
    6364    ext.sources += aubio_sources
     65
     66def add_local_macros(ext, usedouble = False):
    6467    # define macros (waf puts them in build/src/config.h)
    6568    for define_macro in ['HAVE_STDLIB_H', 'HAVE_STDIO_H',
     
    7073        ext.define_macros += [(define_macro, 1)]
    7174
     75def add_external_deps(ext, usedouble = False):
    7276    # loof for additional packages
    7377    print("Info: looking for *optional* additional packages")
     
    127131        if os.path.isdir(output_path):
    128132            distutils.dir_util.remove_tree(output_path)
    129         config = os.path.join('python', 'ext', 'config.h')
    130         distutils.command.clean.clean.run(self)
    131133
    132134from distutils.command.build_ext import build_ext as _build_ext
     
    152154        if self.enable_double:
    153155            extension.define_macros += [('HAVE_AUBIO_DOUBLE', 1)]
    154         if os.path.isfile('src/aubio.h'):
    155             # if aubio headers are found in this directory
    156             add_local_aubio_header(extension)
    157             # was waf used to build the shared lib?
    158             if os.path.isdir(os.path.join('build','src')):
    159                 # link against build/src/libaubio, built with waf
     156        # seack for aubio headers and lib in PKG_CONFIG_PATH
     157        add_system_aubio(extension)
     158        # the lib was not installed on this system
     159        if 'aubio' not in extension.libraries:
     160            # use local src/aubio.h
     161            if os.path.isfile(os.path.join('src', 'aubio.h')):
     162                add_local_aubio_header(extension)
     163            add_local_macros(extension)
     164            # look for a local waf build
     165            if os.path.isfile(os.path.join('build','src', 'fvec.c.1.o')):
    160166                add_local_aubio_lib(extension)
    161167            else:
     168                # check for external dependencies
     169                add_external_deps(extension, usedouble=self.enable_double)
    162170                # add libaubio sources and look for optional deps with pkg-config
    163171                add_local_aubio_sources(extension, usedouble=self.enable_double)
    164         else:
    165             # look for aubio headers and lib using pkg-config
    166             add_system_aubio(extension)
    167172        # generate files python/gen/*.c, python/gen/aubio-generated.h
    168173        extension.sources += generate_external(header, output_path, overwrite = False,
Note: See TracChangeset for help on using the changeset viewer.