shithub: aubio

ref: 01b8fcc1b4d797f0f001d3a4372d1e7f3c1c5b2d
dir: /tests/python/localaubio.py/

View raw version
# add ${src}/python and ${src}/python/aubio/.libs to python path
# so the script is runnable from a compiled source tree.

try:
  from aubio.aubiowrapper import * 
except ImportError:
  try: 
    import os
    import sys
    cur_dir = os.path.dirname(__file__)
    sys.path.append(os.path.join(cur_dir,'..','..','python'))
    # waf places
    sys.path.append(os.path.join(cur_dir,'..','..','python','aubio','.libs'))
    sys.path.append(os.path.join(cur_dir,'..','..','build', 'default', 'swig'))
    # autotools places
    sys.path.append(os.path.join(cur_dir,'..','..','build', 'default', 'python','aubio'))
    try:
      from aubiowrapper import * 
    except ImportError:
      from aubio.aubiowrapper import *
  except ImportError:
    raise
else:
  raise ImportError, \
    """
    The aubio module could be imported BEFORE adding the source directory to
    your path. Make sure you NO other version of the python aubio module is
    installed on your system.
    """