Changeset 1167631
- Timestamp:
- May 13, 2016, 6:50:20 PM (9 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 2e324f5
- Parents:
- c09efca
- Files:
-
- 1 added
- 3 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
Makefile
rc09efca r1167631 29 29 30 30 build_python: 31 cd python &&python ./setup.py generate $(ENABLE_DOUBLE) build31 python ./setup.py generate $(ENABLE_DOUBLE) build 32 32 33 test_python: export LD_LIBRARY_PATH=$(PWD)/build/src 33 34 test_python: 34 cd python && pip install -v . 35 cd python && LD_LIBRARY_PATH=$(PWD)/build/src nose2 --verbose 36 cd python && pip uninstall -y -v aubio 35 pip install -v -r requirements.txt 36 pip install -v . 37 nose2 --verbose 38 pip uninstall -y -v aubio 37 39 38 40 test_python_osx: 39 cd python && pip install --user -v .41 # create links from ~/lib/lib* to build/src/lib* 40 42 [ -f build/src/libaubio.[0-9].dylib ] && ( mkdir -p ~/lib && cp -prv build/src/libaubio.4.dylib ~/lib ) || true 41 cd python && nose2 --verbose 42 cd python && pip uninstall -y -v aubio 43 # then run the tests 44 pip install --user -v -r requirements.txt 45 pip install --user -v . 46 nose2 --verbose 47 pip uninstall -y -v aubio 43 48 44 49 clean_python: 45 cd python &&./setup.py clean50 ./setup.py clean 46 51 47 52 build_python3: 48 cd python &&python3 ./setup.py generate $(ENABLE_DOUBLE) build53 python3 ./setup.py generate $(ENABLE_DOUBLE) build 49 54 50 55 clean_python3: 51 cd python &&python3 ./setup.py clean56 python3 ./setup.py clean 52 57 53 58 clean: -
nose2.cfg
rc09efca r1167631 1 1 [unittest] 2 start-dir = tests/2 start-dir = python/tests/ 3 3 plugins = nose2.plugins.mp 4 4 -
python/lib/gen_external.py
rc09efca r1167631 1 1 import os, glob 2 2 3 header = """// this file is generated! do not modify 3 header = 'src/aubio.h' 4 output_path = 'python/gen' 5 6 source_header = """// this file is generated! do not modify 4 7 #include "aubio-types.h" 5 8 """ … … 42 45 43 46 44 def get_cpp_objects( ):47 def get_cpp_objects(header=header): 45 48 46 cpp_output = [l.strip() for l in os.popen('cpp -DAUBIO_UNSTABLE=1 -I../build/src ../src/aubio.h').readlines()]49 cpp_output = [l.strip() for l in os.popen('cpp -DAUBIO_UNSTABLE=1 {:s}'.format(header)).readlines()] 47 50 #cpp_output = [l.strip() for l in os.popen('cpp -DAUBIO_UNSTABLE=0 -I../build/src ../src/onset/onset.h').readlines()] 48 51 #cpp_output = [l.strip() for l in os.popen('cpp -DAUBIO_UNSTABLE=0 -I../build/src ../src/pitch/pitch.h').readlines()] … … 67 70 return cpp_output, cpp_objects 68 71 69 def generate_external( output_path, usedouble = False, overwrite =True):72 def generate_external(header=header, output_path=output_path, usedouble=False, overwrite=True): 70 73 if not os.path.isdir(output_path): os.mkdir(output_path) 71 74 elif overwrite == False: return glob.glob(os.path.join(output_path, '*.c')) 72 75 sources_list = [] 73 cpp_output, cpp_objects = get_cpp_objects( )76 cpp_output, cpp_objects = get_cpp_objects(header) 74 77 lib = {} 75 78 … … 122 125 """ 123 126 124 from .gen_code import MappedObject 127 try: 128 from .gen_code import MappedObject 129 except (SystemError, ValueError) as e: 130 from gen_code import MappedObject 125 131 for o in lib: 126 out = header132 out = source_header 127 133 mapped = MappedObject(lib[o], usedouble = usedouble) 128 134 out += mapped.gen_code() … … 133 139 sources_list.append(output_file) 134 140 135 out = header141 out = source_header 136 142 out += "#include \"aubio-generated.h\"" 137 143 check_types = "\n || ".join(["PyType_Ready(&Py_%sType) < 0" % o for o in lib]) … … 187 193 188 194 if __name__ == '__main__': 189 output_path = 'gen' 190 generate_external(output_path) 195 import sys 196 if len(sys.argv) > 1: header = sys.argv[1] 197 if len(sys.argv) > 2: output_path = sys.argv[2] 198 generate_external(header, output_path) -
python/lib/moresetuptools.py
rc09efca r1167631 1 1 import distutils, distutils.command.clean, distutils.dir_util 2 from .gen_external import generate_external, header, output_path 2 3 3 4 class CleanGenerated(distutils.command.clean.clean): 4 5 def run(self): 5 distutils.dir_util.remove_tree( 'gen')6 distutils.dir_util.remove_tree(output_path) 6 7 distutils.command.clean.clean.run(self) 7 8 … … 24 25 def run(self): 25 26 self.announce( 'Generating code', level=distutils.log.INFO) 26 from .gen_external import generate_external 27 generated_object_files = generate_external('gen', usedouble = self.enable_double) 27 generated_object_files = generate_external(header, output_path, usedouble = self.enable_double) -
setup.py
rc09efca r1167631 1 1 #! /usr/bin/env python 2 3 from setuptools import setup, Extension4 from lib.moresetuptools import CleanGenerated, GenerateCommand5 2 6 3 import sys 7 4 import os.path 8 5 import numpy 6 from setuptools import setup, Extension 7 from python.lib.moresetuptools import CleanGenerated, GenerateCommand 8 # function to generate gen/*.{c,h} 9 from python.lib.gen_external import generate_external, header, output_path 9 10 10 11 # read from VERSION … … 14 15 + AUBIO_VERSION_STATUS 15 16 16 # function to generate gen/*.{c,h}17 from lib.gen_external import generate_external18 output_path = 'gen'19 20 17 include_dirs = [] 21 18 library_dirs = [] … … 23 20 extra_link_args = [] 24 21 25 include_dirs += [ ' ext' ]22 include_dirs += [ 'python/ext' ] 26 23 include_dirs += [ output_path ] # aubio-generated.h 27 24 include_dirs += [ numpy.get_include() ] … … 30 27 extra_link_args += ['-framework','CoreFoundation', '-framework','AudioToolbox'] 31 28 32 if os.path.isfile(' ../src/aubio.h'):29 if os.path.isfile('src/aubio.h'): 33 30 define_macros += [('USE_LOCAL_AUBIO', 1)] 34 include_dirs += [' ../src'] # aubio.h35 library_dirs += [' ../build/src']31 include_dirs += ['src'] # aubio.h 32 library_dirs += ['build/src'] 36 33 37 34 aubio_extension = Extension("aubio._aubio", [ 38 "ext/aubiomodule.c", 39 "ext/aubioproxy.c", 40 "ext/ufuncs.c", 41 "ext/py-musicutils.c", 42 "ext/py-cvec.c", 43 # example without macro 44 "ext/py-filter.c", 45 # macroised 46 "ext/py-filterbank.c", 47 "ext/py-fft.c", 48 "ext/py-phasevoc.c", 49 "ext/py-source.c", 50 "ext/py-sink.c", 35 "python/ext/aubiomodule.c", 36 "python/ext/aubioproxy.c", 37 "python/ext/ufuncs.c", 38 "python/ext/py-musicutils.c", 39 "python/ext/py-cvec.c", 40 "python/ext/py-filter.c", 41 "python/ext/py-filterbank.c", 42 "python/ext/py-fft.c", 43 "python/ext/py-phasevoc.c", 44 "python/ext/py-source.c", 45 "python/ext/py-sink.c", 51 46 # generate files if they don't exit 52 ] + generate_external( output_path, overwrite = False),47 ] + generate_external(header, output_path, overwrite = False), 53 48 include_dirs = include_dirs, 54 49 library_dirs = library_dirs, … … 75 70 version = __version__, 76 71 packages = ['aubio'], 77 package_dir = {'aubio':' lib/aubio'},78 scripts = [' scripts/aubiocut'],72 package_dir = {'aubio':'python/lib/aubio'}, 73 scripts = ['python/scripts/aubiocut'], 79 74 ext_modules = [aubio_extension], 80 75 description = 'interface to the aubio library', … … 92 87 'clean': CleanGenerated, 93 88 'generate': GenerateCommand, 94 } 89 }, 90 test_suite = 'nose2.collector.collector', 95 91 )
Note: See TracChangeset
for help on using the changeset viewer.