shithub: aubio

Download patch

ref: b1d37c0443da74f2ae5bfa21c6e3913ddc29b779
parent: ca89d9f085abb9ca42ad8676cea44d9056aaf498
author: Paul Brossier <piem@piem.org>
date: Sun May 15 18:51:35 EDT 2016

setup.py: only generate source files in build_ext

--- a/setup.py
+++ b/setup.py
@@ -53,9 +53,6 @@
     add_system_aubio(aubio_extension)
 
 
-# generate files if they don't exit
-aubio_extension.sources += generate_external(header, output_path, overwrite = False)
-
 classifiers = [
     'Development Status :: 4 - Beta',
     'Environment :: Console',
@@ -71,6 +68,14 @@
     'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
     ]
 
+from distutils.command.build_ext import build_ext as _build_ext
+class build_ext(_build_ext):
+
+    def build_extension(self, extension):
+        # generate files python/gen/*.c, python/gen/aubio-generated.h
+        extension.sources += generate_external(header, output_path, overwrite = False)
+        return _build_ext.build_extension(self, extension)
+
 distrib = setup(name='aubio',
     version = __version__,
     packages = ['aubio'],
@@ -91,6 +96,7 @@
     cmdclass = {
         'clean': CleanGenerated,
         'generate': GenerateCommand,
+        'build_ext': build_ext,
         },
     test_suite = 'nose2.collector.collector',
     )