Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/mingw32/Python27/Lib/site-packages/numpy/distutils/command/build_scripts.py @ 87:2a2c65a20a8b
Add Python libs and headers
author | Chris Cannam |
---|---|
date | Wed, 25 Feb 2015 14:05:22 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
86:413a9d26189e | 87:2a2c65a20a8b |
---|---|
1 """ Modified version of build_scripts that handles building scripts from functions. | |
2 | |
3 """ | |
4 from __future__ import division, absolute_import, print_function | |
5 | |
6 from distutils.command.build_scripts import build_scripts as old_build_scripts | |
7 from numpy.distutils import log | |
8 from numpy.distutils.misc_util import is_string | |
9 | |
10 class build_scripts(old_build_scripts): | |
11 | |
12 def generate_scripts(self, scripts): | |
13 new_scripts = [] | |
14 func_scripts = [] | |
15 for script in scripts: | |
16 if is_string(script): | |
17 new_scripts.append(script) | |
18 else: | |
19 func_scripts.append(script) | |
20 if not func_scripts: | |
21 return new_scripts | |
22 | |
23 build_dir = self.build_dir | |
24 self.mkpath(build_dir) | |
25 for func in func_scripts: | |
26 script = func(build_dir) | |
27 if not script: | |
28 continue | |
29 if is_string(script): | |
30 log.info(" adding '%s' to scripts" % (script,)) | |
31 new_scripts.append(script) | |
32 else: | |
33 [log.info(" adding '%s' to scripts" % (s,)) for s in script] | |
34 new_scripts.extend(list(script)) | |
35 return new_scripts | |
36 | |
37 def run (self): | |
38 if not self.scripts: | |
39 return | |
40 | |
41 self.scripts = self.generate_scripts(self.scripts) | |
42 # Now make sure that the distribution object has this list of scripts. | |
43 # setuptools' develop command requires that this be a list of filenames, | |
44 # not functions. | |
45 self.distribution.scripts = self.scripts | |
46 | |
47 return old_build_scripts.run(self) | |
48 | |
49 def get_source_files(self): | |
50 from numpy.distutils.misc_util import get_script_files | |
51 return get_script_files(self.scripts) |