History

python/setup.py: add command 'generate' with option '--enable-double'

Paul Brossier committed 10 years ago

Commit a89ed311 parent 07867cd5 files · +58 −22Browse files

Showing the changes to python/setup.py (1 of 5 files). Show all

Unified · Split

python/setup.py+13−16
@@ -1,6 +1,7 @@
11 #! /usr/bin/env python
22
3−from setuptools import setup, Extension
3+from setuptools import setup, Extension, Command
4+from lib.moresetuptools import CleanGenerated, GenerateCommand
45
56 import sys
67 import os.path
@@ -12,30 +13,22 @@ __version__ = '.'.join \ · 5 unmodified lines
1213 ([str(x) for x in [AUBIO_MAJOR_VERSION, AUBIO_MINOR_VERSION, AUBIO_PATCH_VERSION]]) \
1314 + AUBIO_VERSION_STATUS
1415
16+# function to generate gen/*.{c,h}
17+from lib.gen_external import generate_external
18+output_path = 'gen'
1519
1620 include_dirs = []
1721 library_dirs = []
1822 define_macros = []
1923 extra_link_args = []
2024
21−include_dirs += ['ext']
25+include_dirs += [ 'ext' ]
26+include_dirs += [ output_path ] # aubio-generated.h
2227 include_dirs += [ numpy.get_include() ]
2328
2429 if sys.platform.startswith('darwin'):
2530 extra_link_args += ['-framework','CoreFoundation', '-framework','AudioToolbox']
2631
27−output_path = 'gen'
28−generated_object_files = []
29−
30−if not os.path.isdir(output_path):
31− from lib.gen_external import generate_external
32− generated_object_files = generate_external(output_path)
33− # define include dirs
34−else:
35− import glob
36− generated_object_files = glob.glob(os.path.join(output_path, '*.c'))
37−include_dirs += [output_path]
38−
3932 if os.path.isfile('../src/aubio.h'):
4033 define_macros += [('USE_LOCAL_AUBIO', 1)]
4134 include_dirs += ['../src'] # aubio.h
@@ -56,8 +49,8 @@ aubio_extension = Extension("aubio._aubio", [ · 14 unmodified lines
5649 "ext/py-phasevoc.c",
5750 "ext/py-source.c",
5851 "ext/py-sink.c",
59− # generated files
60− ] + generated_object_files,
52+ # generate files if they don't exit
53+ ] + generate_external(output_path, overwrite = False),
6154 include_dirs = include_dirs,
6255 library_dirs = library_dirs,
6356 extra_link_args = extra_link_args,
@@ -96,4 +89,8 @@ distrib = setup(name='aubio', · 32 unmodified lines
9689 platforms = 'any',
9790 classifiers = classifiers,
9891 install_requires = ['numpy'],
92+ cmdclass = {
93+ 'clean': CleanGenerated,
94+ 'generate': GenerateCommand,
95+ }
9996 )

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t