move python/setup.py to setup.py, update Makefile, add requirements
[aubio.git] / python / lib / moresetuptools.py
1 import distutils, distutils.command.clean, distutils.dir_util
2 from .gen_external import generate_external, header, output_path
3
4 class CleanGenerated(distutils.command.clean.clean):
5     def run(self):
6         distutils.dir_util.remove_tree(output_path)
7         distutils.command.clean.clean.run(self)
8
9 class GenerateCommand(distutils.cmd.Command):
10     description = 'generate gen/gen-*.c files from ../src/aubio.h'
11     user_options = [
12             # The format is (long option, short option, description).
13             ('enable-double', None, 'use HAVE_AUBIO_DOUBLE=1 (default: 0)'),
14             ]
15
16     def initialize_options(self):
17         self.enable_double = False
18
19     def finalize_options(self):
20         if self.enable_double:
21             self.announce(
22                     'will generate code for aubio compiled with HAVE_AUBIO_DOUBLE=1',
23                     level=distutils.log.INFO)
24
25     def run(self):
26         self.announce( 'Generating code', level=distutils.log.INFO)
27         generated_object_files = generate_external(header, output_path, usedouble = self.enable_double)