- Timestamp:
- Apr 25, 2016, 11:33:11 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:
- c31b589
- Parents:
- 07867cd
- Location:
- python
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
python/ext/aubio-types.h
r07867cd ra89ed31 1 1 #include <Python.h> 2 2 #include <structmember.h> 3 4 #include "aubio-generated.h" 3 5 4 6 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION -
python/ext/aubiomodule.c
r07867cd ra89ed31 1 1 #define PY_AUBIO_MODULE_MAIN 2 2 #include "aubio-types.h" 3 #include "aubio-generated.h"4 3 #include "py-musicutils.h" 5 4 -
python/lib/gen_external.py
r07867cd ra89ed31 1 import os 1 import os, glob 2 2 3 3 header = """// this file is generated! do not modify … … 67 67 return cpp_output, cpp_objects 68 68 69 def generate_external(output_path, usedouble = False ):69 def generate_external(output_path, usedouble = False, overwrite = True): 70 70 if not os.path.isdir(output_path): os.mkdir(output_path) 71 elif overwrite == False: return glob.glob(os.path.join(output_path, '*.c')) 71 72 sources_list = [] 72 73 cpp_output, cpp_objects = get_cpp_objects() … … 161 162 162 163 objlist = "".join(["extern PyTypeObject Py_%sType;\n" % p for p in lib]) 163 out = """ 164 // generated list of objects created with gen_external.py 164 out = """// generated list of objects created with gen_external.py 165 165 166 #include <Python.h> 166 167 """ 168 if usedouble: 169 out += """ 170 #ifndef HAVE_AUBIO_DOUBLE 171 #define HAVE_AUBIO_DOUBLE 1 172 #endif 173 """ 174 out += """ 167 175 {objlist} 168 176 int generated_objects ( void ); -
python/setup.py
r07867cd ra89ed31 1 1 #! /usr/bin/env python 2 2 3 from setuptools import setup, Extension 3 from setuptools import setup, Extension, Command 4 from lib.moresetuptools import CleanGenerated, GenerateCommand 4 5 5 6 import sys … … 13 14 + AUBIO_VERSION_STATUS 14 15 16 # function to generate gen/*.{c,h} 17 from lib.gen_external import generate_external 18 output_path = 'gen' 15 19 16 20 include_dirs = [] … … 19 23 extra_link_args = [] 20 24 21 include_dirs += ['ext'] 25 include_dirs += [ 'ext' ] 26 include_dirs += [ output_path ] # aubio-generated.h 22 27 include_dirs += [ numpy.get_include() ] 23 28 24 29 if sys.platform.startswith('darwin'): 25 30 extra_link_args += ['-framework','CoreFoundation', '-framework','AudioToolbox'] 26 27 output_path = 'gen'28 generated_object_files = []29 30 if not os.path.isdir(output_path):31 from lib.gen_external import generate_external32 generated_object_files = generate_external(output_path)33 # define include dirs34 else:35 import glob36 generated_object_files = glob.glob(os.path.join(output_path, '*.c'))37 include_dirs += [output_path]38 31 39 32 if os.path.isfile('../src/aubio.h'): … … 57 50 "ext/py-source.c", 58 51 "ext/py-sink.c", 59 # generate d files60 ] + generate d_object_files,52 # generate files if they don't exit 53 ] + generate_external(output_path, overwrite = False), 61 54 include_dirs = include_dirs, 62 55 library_dirs = library_dirs, … … 97 90 classifiers = classifiers, 98 91 install_requires = ['numpy'], 92 cmdclass = { 93 'clean': CleanGenerated, 94 'generate': GenerateCommand, 95 } 99 96 )
Note: See TracChangeset
for help on using the changeset viewer.